Your project should not use insecure random number functions
- Read doc
- Security
- Major
More information: https://insight.symfony.com/what-we-analyse/php.use_insecure_random_function
- } catch (Exception $e) {
- if ($secure === true) {
- throw $e;
- }
- $result = mt_rand($min, $max);
- }
- return $result;
- }
Your project should use dedicated PHP string functions 10
- Read doc
- Productivity
- Info
More information: https://insight.symfony.com/what-we-analyse/php.use_string_function
- $llmProvider = 'openai'; // Default
- if (defined('CLICSHOPPING_APP_CHATGPT_CH_MODEL')) {
- $model = CLICSHOPPING_APP_CHATGPT_CH_MODEL;
- // Determine provider from model name
- if (strpos($model, 'anth-') === 0 || strpos($model, 'claude') !== false) {
- $llmProvider = 'anthropic';
- } elseif (strpos($model, 'mistral') !== false) {
- $llmProvider = 'mistral';
- } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
- $llmProvider = 'ollama';
- $model = CLICSHOPPING_APP_CHATGPT_CH_MODEL;
- // Determine provider from model name
- if (strpos($model, 'anth-') === 0 || strpos($model, 'claude') !== false) {
- $llmProvider = 'anthropic';
- } elseif (strpos($model, 'mistral') !== false) {
- $llmProvider = 'mistral';
- } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
- $llmProvider = 'ollama';
- } elseif (strpos($model, 'openai/') === 0 || strpos($model, 'microsoft/') === 0 || strpos($model, 'qwen/') === 0) {
- $llmProvider = 'lmstudio';
- // Determine provider from model name
- if (strpos($model, 'anth-') === 0 || strpos($model, 'claude') !== false) {
- $llmProvider = 'anthropic';
- } elseif (strpos($model, 'mistral') !== false) {
- $llmProvider = 'mistral';
- } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
- $llmProvider = 'ollama';
- } elseif (strpos($model, 'openai/') === 0 || strpos($model, 'microsoft/') === 0 || strpos($model, 'qwen/') === 0) {
- $llmProvider = 'lmstudio';
- } else {
- // Default to OpenAI for gpt-* models
- $llmProvider = 'openai'; // Default
- if (defined('CLICSHOPPING_APP_CHATGPT_CH_MODEL')) {
- $model = CLICSHOPPING_APP_CHATGPT_CH_MODEL;
- // Determine provider from model name
- if (strpos($model, 'anth-') === 0 || strpos($model, 'claude') !== false) {
- $llmProvider = 'anthropic';
- } elseif (strpos($model, 'mistral') !== false) {
- $llmProvider = 'mistral';
- } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
- $llmProvider = 'ollama';
- $llmProvider = 'anthropic';
- } elseif (strpos($model, 'mistral') !== false) {
- $llmProvider = 'mistral';
- } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
- $llmProvider = 'ollama';
- } elseif (strpos($model, 'openai/') === 0 || strpos($model, 'microsoft/') === 0 || strpos($model, 'qwen/') === 0) {
- $llmProvider = 'lmstudio';
- } else {
- // Default to OpenAI for gpt-* models
- $llmProvider = 'openai';
- }
- if ($zip->open($filename_localisation) === true) {
- $has_traversal = false;
- for ($i = 0; $i < $zip->numFiles; $i++) {
- $filename = $zip->getNameIndex($i);
- // Check for path traversal
- if (strpos($filename, '..') !== false || strpos($filename, '/') === 0 || strpos($filename, '\\') === 0) {
- $has_traversal = true;
- break;
- }
- // Check for absolute paths
- if (preg_match('/^[a-zA-Z]:\\/', $filename)) {
- if ($zip->open($filename_localisation) === true) {
- $has_traversal = false;
- for ($i = 0; $i < $zip->numFiles; $i++) {
- $filename = $zip->getNameIndex($i);
- // Check for path traversal
- if (strpos($filename, '..') !== false || strpos($filename, '/') === 0 || strpos($filename, '\\') === 0) {
- $has_traversal = true;
- break;
- }
- // Check for absolute paths
- if (preg_match('/^[a-zA-Z]:\\/', $filename)) {
- if ($response === '') {
- return $response;
- }
- // If there are no HTML tags at all, skip the work
- $hasTags = (\strpos($response, '<') !== false);
- if ($hasTags) {
- $response = \strip_tags($response);
- $response = \html_entity_decode($response, ENT_QUOTES | ENT_HTML5, 'UTF-8');
- }
- }
- $expectedV6 = filter_var($expected, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
- $actualV6 = filter_var($actual, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
- if ($expectedV6 !== false && $actualV6 !== false) {
- return substr(inet_pton($expectedV6), 0, 8) === substr(inet_pton($actualV6), 0, 8);
- }
- // Mixed family or unparseable — fall back to strict to avoid silent bypass.
- return $expected === $actual;
- }
- $expectedV6 = filter_var($expected, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
- $actualV6 = filter_var($actual, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
- if ($expectedV6 !== false && $actualV6 !== false) {
- // Same /64 — first 8 bytes of the 16-byte packed form.
- return substr(inet_pton($expectedV6), 0, 8) === substr(inet_pton($actualV6), 0, 8);
- }
- // Mixed family or unparseable — fall back to strict to avoid silent bypass.
- return $expected === $actual;
- }
gyakutsuki