Your project should not use insecure random number functions 54
- Read doc
- Security
- Major
More information: https://insight.symfony.com/what-we-analyse/php.use_insecure_random_function
New rule!
We've recently added this rule to Insight. Don't be surprised to see new suggestions even though the codebase didn't change.
- $code_length = max(4, min(8, $code_length)); // Limiter entre 4 et 8
- $verification_code = '';
- for ($i = 0; $i < $code_length; $i++) {
- $verification_code .= mt_rand(0, 9);
- }
- $expiry_minutes = defined('EMAIL_VERIFICATION_CODE_EXPIRY') ? (int)EMAIL_VERIFICATION_CODE_EXPIRY : 15;
- $expiry_time = date('Y-m-d H:i:s', time() + ($expiry_minutes * 60));
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff)
- );
- }
- /**
- '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff)
- );
- }
- return sprintf(
- '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff)
- );
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff)
- );
- }
- /**
- * Get security statistics for dashboard
- {
- return sprintf(
- '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff)
- */
- private function generateEventId(): string
- {
- return sprintf(
- '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff)
- );
- }
- private function generateEventId(): string
- {
- return sprintf(
- '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff)
- );
- }
- /**
- * Get the objective ID
- private function generateObjectiveId(): string
- {
- return sprintf(
- '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff)
- );
- }
- /**
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff)
- );
- }
- return sprintf(
- '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff)
- );
- '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff)
- );
- }
- */
- private function generateObjectiveId(): string
- {
- return sprintf(
- '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- {
- return sprintf(
- '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000,
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff),
- mt_rand(0, 0xffff)
- * @param array $data The order data.
- * @return void
- */
- protected function createOrder(array $data): void
- {
- $orderId = rand(1000, 9999);
- $this->message->sendSuccess(['action' => 'create_order', 'order_id' => $orderId]);
- }
- /**
- * Updates an existing order. Placeholder method.
- $code_length = defined('EMAIL_VERIFICATION_CODE_LENGTH') ? (int)EMAIL_VERIFICATION_CODE_LENGTH : 6;
- $code_length = max(4, min(8, $code_length));
- $verification_code = '';
- for ($i = 0; $i < $code_length; $i++) {
- $verification_code .= mt_rand(0, 9);
- }
- // Durée d'expiration
- $expiry_minutes = defined('EMAIL_VERIFICATION_CODE_EXPIRY') ? (int)EMAIL_VERIFICATION_CODE_EXPIRY : 15;
- */
- private function getTotalRequests(): int
- {
- // In a real implementation, this would query the database
- // For simulation, return a random number
- return rand(100, 1000);
- }
- /**
- * Gets the error count (simulated).
- *
- *
- * @return float The average response time in milliseconds.
- */
- private function getAverageResponseTime(): float
- {
- return round(rand(100, 800) / 10, 2);
- }
- /**
- * Gets the requests per minute (simulated).
- *
- 'peak_hours' => [9, 10, 11, 14, 15, 16],
- 'avg_concurrent_users' => rand(10, 100),
- 'most_used_endpoints' => [
- '/api/chat' => rand(100, 500),
- '/api/status' => rand(50, 200),
- '/api/health' => rand(20, 100)
- ]
- ];
- }
- /**
- return [
- 'hourly' => array_map(function ($hour) {
- return ['hour' => $hour, 'errors' => rand(0, 5)];
- }, range(0, 23)),
- 'daily' => array_map(function ($day) {
- return ['day' => $day, 'errors' => rand(0, 50)];
- }, range(1, 7))
- ];
- }
- /**
- *
- * @return int The number of requests per minute.
- */
- private function getRequestsPerMinute(): int
- {
- return rand(10, 100);
- }
- /**
- * Gets memory usage information.
- *
- */
- private function getUsagePatterns(): array
- {
- return [
- 'peak_hours' => [9, 10, 11, 14, 15, 16],
- 'avg_concurrent_users' => rand(10, 100),
- 'most_used_endpoints' => [
- '/api/chat' => rand(100, 500),
- '/api/status' => rand(50, 200),
- '/api/health' => rand(20, 100)
- ]
- * @return float The CPU usage percentage.
- */
- private function getCpuUsage(): float
- {
- // Simulate CPU usage
- return round(rand(10, 80) / 10, 1);
- }
- /**
- * Gets disk space information.
- *
- return [
- 'peak_hours' => [9, 10, 11, 14, 15, 16],
- 'avg_concurrent_users' => rand(10, 100),
- 'most_used_endpoints' => [
- '/api/chat' => rand(100, 500),
- '/api/status' => rand(50, 200),
- '/api/health' => rand(20, 100)
- ]
- ];
- }
- * @return int The error count.
- */
- private function getErrorCount(): int
- {
- // Simulate low error count for healthy status
- return rand(0, 5);
- }
- /**
- * Gets the average response time (simulated).
- *
- private function getErrorTrends(): array
- {
- // Simulate error trends
- return [
- 'hourly' => array_map(function ($hour) {
- return ['hour' => $hour, 'errors' => rand(0, 5)];
- }, range(0, 23)),
- 'daily' => array_map(function ($day) {
- return ['day' => $day, 'errors' => rand(0, 50)];
- }, range(1, 7))
- ];
- {
- return [
- 'peak_hours' => [9, 10, 11, 14, 15, 16],
- 'avg_concurrent_users' => rand(10, 100),
- 'most_used_endpoints' => [
- '/api/chat' => rand(100, 500),
- '/api/status' => rand(50, 200),
- '/api/health' => rand(20, 100)
- ]
- ];
- }
- // Simulate response time history
- $history = [];
- for ($i = 0; $i < 24; $i++) {
- $history[] = [
- 'hour' => $i,
- 'avg_response_time' => rand(100, 800) / 10
- ];
- }
- return $history;
- }
- $metrics = [
- 'request_rate' => rand(20, 80),
- 'average_latency' => rand(100, 300),
- 'error_frequency' => rand(0, 10),
- 'uptime_percentage' => rand(95, 100),
- 'total_requests' => rand(1000, 5000)
- ];
- // Store current metrics for persistence
- $this->historyStorage->storeMetrics($metrics);
- */
- public function getPerformanceData(string $range = '24h'): array
- {
- // Generate current metrics
- $metrics = [
- 'request_rate' => rand(20, 80),
- 'average_latency' => rand(100, 300),
- 'error_frequency' => rand(0, 10),
- 'uptime_percentage' => rand(95, 100),
- 'total_requests' => rand(1000, 5000)
- ];
- {
- // Generate current metrics
- $metrics = [
- 'request_rate' => rand(20, 80),
- 'average_latency' => rand(100, 300),
- 'error_frequency' => rand(0, 10),
- 'uptime_percentage' => rand(95, 100),
- 'total_requests' => rand(1000, 5000)
- ];
- // Store current metrics for persistence
- public function getPerformanceData(string $range = '24h'): array
- {
- // Generate current metrics
- $metrics = [
- 'request_rate' => rand(20, 80),
- 'average_latency' => rand(100, 300),
- 'error_frequency' => rand(0, 10),
- 'uptime_percentage' => rand(95, 100),
- 'total_requests' => rand(1000, 5000)
- ];
- $history[] = [
- 'timestamp' => $timestamp,
- 'latency' => rand(50, 200),
- 'error_rate' => rand(0, 5),
- 'requests' => rand(10, 50),
- 'uptime' => rand(95, 100)
- ];
- }
- return array_reverse($history);
- }
- $timestamp = $baseTime - ($i * $interval);
- $history[] = [
- 'timestamp' => $timestamp,
- 'latency' => rand(50, 200),
- 'error_rate' => rand(0, 5),
- 'requests' => rand(10, 50),
- 'uptime' => rand(95, 100)
- ];
- }
- return array_reverse($history);
- for ($i = 0; $i < $points; $i++) {
- $timestamp = $baseTime - ($i * $interval);
- $history[] = [
- 'timestamp' => $timestamp,
- 'latency' => rand(50, 200),
- 'error_rate' => rand(0, 5),
- 'requests' => rand(10, 50),
- 'uptime' => rand(95, 100)
- ];
- }
- for ($i = 0; $i < $points; $i++) {
- $timestamp = $baseTime - ($i * $interval);
- $history[] = [
- 'timestamp' => $timestamp,
- 'latency' => rand(50, 200),
- 'error_rate' => rand(0, 5),
- 'requests' => rand(10, 50),
- 'uptime' => rand(95, 100)
- ];
- }
- // Generate current metrics
- $metrics = [
- 'request_rate' => rand(20, 80),
- 'average_latency' => rand(100, 300),
- 'error_frequency' => rand(0, 10),
- 'uptime_percentage' => rand(95, 100),
- 'total_requests' => rand(1000, 5000)
- ];
- // Store current metrics for persistence
- $this->historyStorage->storeMetrics($metrics);
- $CLICSHOPPING_MessageStack = Registry::get('MessageStack');
- if ($this->_replace === true) {
- while (file_exists($this->_destination . DIRECTORY_SEPARATOR . $this->getFilename())) {
- $salt = md5(rand(1, 100000));
- $salt = substr($salt, 0, 10);
- $this->setFilename($salt . '_' . $this->getFilename());
- }
- }
- if (isset($_GET[$this->_file])) {
- $temp_filename = 'temp_' . mt_rand(100000, 999999);
- while (file_exists(CLICSHOPPING::BASE_DIR . 'Work/Temp/' . $temp_filename)) {
- $temp_filename = 'temp_' . mt_rand(100000, 999999);
- }
- $input = fopen('php://input', 'r');
- $size = file_put_contents(CLICSHOPPING::BASE_DIR . 'Work/Temp/' . $temp_filename, $input);
- public function check(): bool
- {
- $CLICSHOPPING_MessageStack = Registry::get('MessageStack');
- if (isset($_GET[$this->_file])) {
- $temp_filename = 'temp_' . mt_rand(100000, 999999);
- while (file_exists(CLICSHOPPING::BASE_DIR . 'Work/Temp/' . $temp_filename)) {
- $temp_filename = 'temp_' . mt_rand(100000, 999999);
- }
- for ($i = 100; $i > 0; $i--) {
- $this->performanceHistory[] = [
- 'timestamp' => $now - ($i * 900), // Every 15 minutes
- 'requests' => rand(100, 1000),
- 'latency' => rand(50, 200),
- 'error_rate' => rand(0, 5),
- 'status' => rand(1, 100) > 98 ? 'down' : 'up'
- ];
- }
- }
- }
- $now = time();
- for ($i = 100; $i > 0; $i--) {
- $this->performanceHistory[] = [
- 'timestamp' => $now - ($i * 900), // Every 15 minutes
- 'requests' => rand(100, 1000),
- 'latency' => rand(50, 200),
- 'error_rate' => rand(0, 5),
- 'status' => rand(1, 100) > 98 ? 'down' : 'up'
- ];
- }
- }
- $this->performanceHistory[] = [
- 'timestamp' => $now - ($i * 900), // Every 15 minutes
- 'requests' => rand(100, 1000),
- 'latency' => rand(50, 200),
- 'error_rate' => rand(0, 5),
- 'status' => rand(1, 100) > 98 ? 'down' : 'up'
- ];
- }
- }
- }
- {
- $now = time();
- for ($i = 100; $i > 0; $i--) {
- $this->performanceHistory[] = [
- 'timestamp' => $now - ($i * 900), // Every 15 minutes
- 'requests' => rand(100, 1000),
- 'latency' => rand(50, 200),
- 'error_rate' => rand(0, 5),
- 'status' => rand(1, 100) > 98 ? 'down' : 'up'
- ];
- }
- *
- * @return string Returns the anti-spam numeric confirmation string for display or verification purposes.
- */
- public static function getConfirmationNumericAntiSpam(): string
- {
- $random_number = rand(1, 200);
- $number = $random_number + 3;
- $antispam = ' (' . $random_number . ' + ' . CLICSHOPPING::getDef('text_antispam') . ') x 1';
- $_SESSION['createResponseAntiSpam'] = md5($number);
- *
- * @return string The temporary password.
- */
- private function generateTemporaryPassword(): string
- {
- return substr(md5(uniqid(rand(), true)), 0, 8);
- }
- /**
- * Inserts the primary customer record into the :table_customers table.
- *
- *
- * @return string The temporary password.
- */
- private function generateTemporaryPassword(): string
- {
- return substr(md5(uniqid(rand(), true)), 0, 8);
- }
- /**
- * Inserts the primary customer record into the :table_customers table.
- *
- $code_length = max(4, min(8, $code_length)); // Limiter entre 4 et 8
- $verification_code = '';
- for ($i = 0; $i < $code_length; $i++) {
- $verification_code .= mt_rand(0, 9);
- }
- $expiry_minutes = defined('EMAIL_VERIFICATION_CODE_EXPIRY') ? (int)EMAIL_VERIFICATION_CODE_EXPIRY : 15;
- $expiry_time = date('Y-m-d H:i:s', time() + ($expiry_minutes * 60));
- * @return string The sanitized or generated product model.
- */
- public function getProductModel(): string
- {
- if (empty($_POST['products_model'])) {
- $rand = rand();
- $products_model = \defined('CONFIGURATION_PREFIX_MODEL') ? CONFIGURATION_PREFIX_MODEL . $rand : '';
- } else {
- $products_model = HTML::sanitize($_POST['products_model']);
- }
- $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $charactersLength = strlen($characters);
- $randomString = '';
- for ($i = 0; $i < $length; $i++) {
- $randomString .= $characters[rand(0, $charactersLength - 1)];
- }
- return $randomString;
- }
- /**
- $error = true;
- $CLICSHOPPING_MessageStack->add($CLICSHOPPING_Customers->getDef('error_email_address_exist'), 'error');
- }
- if ($error === false) {
- $customers_password = 'clicshopping_' . rand(5, 500);
- // Autorisation aux clients de modifier informations societe et adresse principal + Ajout adresse
- if ($customers_modify_company !== 1) {
- $customers_modify_company = 0;
- }
Your project uses legacy callable syntax instead of first-class callable syntax 25
- Read doc
- Productivity
- Info
More information: https://insight.symfony.com/what-we-analyse/php.use_first_class_callable_syntax
New rule!
We've recently added this rule to Insight. Don't be surprised to see new suggestions even though the codebase didn't change.
- if (class_exists('Memcached')) {
- $this->orig_module_name = session_module_name();
- session_set_save_handler(
- [$this, 'open'],
- [$this, 'close'],
- [$this, 'read'],
- [$this, 'write'],
- [$this, 'destroy'],
- [$this, 'gc']
- [$this, 'open'],
- [$this, 'close'],
- [$this, 'read'],
- [$this, 'write'],
- [$this, 'destroy'],
- [$this, 'gc']
- );
- }
- }
- /**
- session_set_save_handler(
- [$this, 'open'],
- [$this, 'close'],
- [$this, 'read'],
- [$this, 'write'],
- [$this, 'destroy'],
- [$this, 'gc']
- );
- }
- }
- session_set_save_handler(
- [$this, 'open'],
- [$this, 'close'],
- [$this, 'read'],
- [$this, 'write'],
- [$this, 'destroy'],
- [$this, 'gc']
- );
- }
- }
- $this->orig_module_name = session_module_name();
- session_set_save_handler(
- [$this, 'open'],
- [$this, 'close'],
- [$this, 'read'],
- [$this, 'write'],
- [$this, 'destroy'],
- [$this, 'gc']
- );
- }
- if (class_exists('Memcached')) {
- $this->orig_module_name = session_module_name();
- session_set_save_handler(
- [$this, 'open'],
- [$this, 'close'],
- [$this, 'read'],
- [$this, 'write'],
- [$this, 'destroy'],
- [$this, 'gc']
- );
- $this->db = Registry::get('Db');
- }
- // Register shutdown function to flush buffer
- if ($bufferEnabled) {
- register_shutdown_function([$this, 'flushBuffer']);
- }
- $this->stats = new SecurityStatistics();
- }
- return $document;
- }
- public function embedDocuments(array $documents): array
- {
- return array_map([$this, 'embedDocument'], $documents);
- }
- public function getEmbeddingLength(): int
- {
- return NewVector::getEmbeddingLength();
- [$this, 'open'],
- [$this, 'close'],
- [$this, 'read'],
- [$this, 'write'],
- [$this, 'destroy'],
- [$this, 'gc']
- );
- }
- }
- /**
- $this->orig_module_name = session_module_name();
- session_set_save_handler(
- [$this, 'open'],
- [$this, 'close'],
- [$this, 'read'],
- [$this, 'write'],
- [$this, 'destroy'],
- [$this, 'gc']
- );
- }
- if (class_exists('\Redis')) {
- $this->orig_module_name = session_module_name();
- session_set_save_handler(
- [$this, 'open'],
- [$this, 'close'],
- [$this, 'read'],
- [$this, 'write'],
- [$this, 'destroy'],
- [$this, 'gc']
- );
- if (class_exists('\Redis')) {
- $this->orig_module_name = session_module_name();
- session_set_save_handler(
- [$this, 'open'],
- [$this, 'close'],
- [$this, 'read'],
- [$this, 'write'],
- [$this, 'destroy'],
- [$this, 'gc']
- session_set_save_handler(
- [$this, 'open'],
- [$this, 'close'],
- [$this, 'read'],
- [$this, 'write'],
- [$this, 'destroy'],
- [$this, 'gc']
- );
- }
- }
- session_set_save_handler(
- [$this, 'open'],
- [$this, 'close'],
- [$this, 'read'],
- [$this, 'write'],
- [$this, 'destroy'],
- [$this, 'gc']
- );
- }
- }
- if (!isset($args[2])) {
- $args[2] = $this->vendor . '-' . $this->code;
- }
- return call_user_func_array([$this->lang, 'getDef'], $args);
- }
- /**
- * Checks whether a definitions file exists for the specified group and optionally a language code.
- *
- return $document;
- }
- public function embedDocuments(array $documents): array
- {
- return array_map([$this, 'embedDocument'], $documents);
- }
- public function getEmbeddingLength(): int
- {
- return NewVector::getEmbeddingLength();
- if (isset($cache)) {
- if (!is_array($cache)) {
- $cache = [$cache];
- }
- call_user_func_array([$Q, 'setCache'], $cache);
- }
- $Q->execute();
- return $Q;
- $this->read();
- }
- if (is_array($this->listing) && (count($this->listing) > 0)) {
- if ($sort_by_directories === true) {
- usort($this->listing, array($this, 'sortListing'));
- }
- return $this->listing;
- }
- $page = $matches[2];
- }
- $args[0] = 'Shop/public/Sites/' . $req_site . DIRECTORY_SEPARATOR . $page;
- $url = forward_static_call_array([self::class, 'link'], $args);
- return $url;
- }
- /**
- */
- public static function getDef(): string
- {
- $CLICSHOPPING_Language = Registry::get('Language');
- return call_user_func_array([$CLICSHOPPING_Language, 'getDef'], func_get_args());
- }
- /**
- * Checks if the specified route exists by comparing the beginning of the $_GET keys with the given path array.
- *
- */
- public static function redirect(): string
- {
- $args = func_get_args();
- $url = call_user_func_array([self::class, 'link'], $args);
- if ((strstr($url, "\n") !== false) || (strstr($url, "\r") !== false)) {
- $url = self::link(null, '', false);
- }
- $page = $matches[2];
- }
- $args[0] = $req_site . DIRECTORY_SEPARATOR . self::getConfig('http_images_path', $req_site) . $page;
- $url = forward_static_call_array([static::class, 'link'], $args);
- return $url;
- }
- /**
- // Extract tables from DELETE FROM
- $tables = array_merge($tables, self::extractDeleteTable($normalizedQuery, $upperQuery));
- // Remove duplicates and clean table names
- $tables = array_unique($tables);
- $tables = array_map([self::class, 'cleanTableName'], $tables);
- $tables = array_filter($tables); // Remove empty strings
- return array_values($tables);
- }
- ($this->onOpen)();
- }
- try {
- // Utilisation du streaming de la nouvelle classe Stream
- Stream::executeStreaming($parameters, [$this, 'processStreamData']);
- } catch (Exception $e) {
- throw $e;
- } finally {
- $this->connected = false;
- */
- public function invalidateCacheByTables(array $tableNames): int
- {
- $invalidated = 0;
- $cleanTableNames = array_map(
- [SQLTableParser::class, 'cleanTableName'],
- $tableNames
- );
- // Invalidate from Redis
- if ($this->useRedis && $this->redis) {
Your project should use dedicated PHP string functions
- Read doc
- Productivity
- Info
More information: https://insight.symfony.com/what-we-analyse/php.use_string_function
- // Track statistics
- if (strlen($columnComment) > 0) {
- $backup_stats['columns_with_comments']++;
- }
- if (strpos(strtolower($columnType), 'vector') !== false) {
- $backup_stats['vector_columns']++;
- }
- $schema .= ' ' . $Qfields->value('COLUMN_NAME') . ' ' . $columnType;