Your project must restrict allowed classes when using unserialize()

More information: https://insight.symfony.com/what-we-analyse/php.use_unserialize_without_allowed_classes

  1. $redis = $redis_client;
  2. $raw = $redis->get($cache_key);
  3. // phpredis ne sérialise pas les tableaux : la valeur est stockée via serialize()
  4. if ($raw !== false) {
  5. $decoded = @unserialize($raw);
    unserialize() is called without the allowed_classes option, which can lead to PHP object injection attacks.
    Time to fix: about 15 minutes
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. if (is_array($decoded)) {
  7. $cached_config = $decoded;
  8. }
  9. }

Your project should use dedicated PHP string functions 30

More information: https://insight.symfony.com/what-we-analyse/php.use_string_function

  1. $module_active = $modules_shipping;
  2. $include_modules = [];
  3. foreach ($modules_shipping as $value) {
  4. if (strpos($value, '\\') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  5. $class = Apps::getModuleClass($value, 'Shipping');
  6. $include_modules[] = ['class' => $value,
  7. 'file' => $class
  8. ];
  • gyakutsuki

    not included
  1. ];
  2. }
  3. }
  4. for ($i = 0, $n = \count($include_modules); $i < $n; $i++) {
  5. if (strpos($include_modules[$i]['class'], '\\') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  6. Registry::set('Payment_' . str_replace('\\', '_', $include_modules[$i]['class']), new $include_modules[$i]['file']);
  7. $module = Registry::get('Payment_' . str_replace('\\', '_', $include_modules[$i]['class']));
  8. ?>
  9. <div class="row">
  10. <div class="col-md-12">
  • gyakutsuki

    not included
  1. $module_active = $modules_payment;
  2. $include_modules = [];
  3. foreach ($modules_payment as $value) {
  4. if (strpos($value, '\\') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  5. $class = Apps::getModuleClass($value, 'Payment');
  6. $include_modules[] = ['class' => $value,
  7. 'file' => $class
  8. ];
  • gyakutsuki

    not included
  1. ];
  2. }
  3. }
  4. for ($i = 0, $n = \count($include_modules); $i < $n; $i++) {
  5. if (strpos($include_modules[$i]['class'], '\\') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  6. Registry::set('Shipping_' . str_replace('\\', '_', $include_modules[$i]['class']), new $include_modules[$i]['file']);
  7. $module = Registry::get('Shipping_' . str_replace('\\', '_', $include_modules[$i]['class']));
  8. ?>
  9. <div class="row">
  10. <div class="col-md-5">
  • gyakutsuki

    not included
  1. $sessionId = $checkoutIdParam;
  2. }
  3. if ($method === 'POST' && ($hasCheckoutParam || strpos($path, '/checkout_sessions') !== false)) {
  4. if ($sessionId) {
  5. if ($hasCompleteParam || strpos($path, '/complete') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. $validation = $CLICSHOPPING_getRetailers->validateAcpInput($input, 'complete', $input['items'] ?? []);
  7. if (!empty($validation)) {
  8. http_response_code(400);
  9. echo json_encode(['messages' => $validation], JSON_UNESCAPED_SLASHES);
  10. exit;
  • gyakutsuki

    not included
  1. echo json_encode($result['checkout_session'], JSON_UNESCAPED_SLASHES);
  2. } else {
  3. echo json_encode($result, JSON_UNESCAPED_SLASHES);
  4. }
  5. }
  6. } elseif ($hasCancelParam || strpos($path, '/cancel') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  7. $result = $CLICSHOPPING_getRetailers->cancelSession($sessionId);
  8. if ($result === null) {
  9. http_response_code(404);
  10. echo json_encode(['error' => 'Session not found']);
  11. } else {
  • gyakutsuki

    not included
  1. // --------------------------------------------------------------------------------
  2. // GET /products - Returns product catalog
  3. // --------------------------------------------------------------------------------
  4. if ($method === 'GET' && ($hasProductsParam || strpos($path, '/products') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  5. // Return full product catalog
  6. $products = $CLICSHOPPING_getRetailers->getProducts();
  7. echo json_encode(['products' => $products], JSON_UNESCAPED_SLASHES);
  8. exit;
  • gyakutsuki

    not included
  1. // POST /complete_and_order - Complete session then create order
  2. // --------------------------------------------------------------------------------
  3. $hasCompleteAndOrderParam = isset($_GET['complete_and_order']);
  4. $completeSessionIdParam = isset($_GET['session_id']) ? (string)$_GET['session_id'] : null;
  5. if ($method === 'POST' && ($hasCompleteAndOrderParam || strpos($path, '/complete_and_order') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. if (empty($completeSessionIdParam)) {
  7. http_response_code(400);
  8. echo json_encode(['error' => 'Session ID required']);
  9. exit;
  10. }
  • gyakutsuki

    not included
  1. // POST /create_order - Create ClicShopping order from session
  2. // --------------------------------------------------------------------------------
  3. $hasCreateOrderParam = isset($_GET['create_order']);
  4. $orderSessionIdParam = isset($_GET['session_id']) ? (string)$_GET['session_id'] : null;
  5. if ($method === 'POST' && ($hasCreateOrderParam || strpos($path, '/create_order') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. if (empty($orderSessionIdParam)) {
  7. http_response_code(400);
  8. echo json_encode(['error' => 'Session ID required']);
  9. exit;
  10. }
  • gyakutsuki

    not included
  1. } elseif (!empty($checkoutIdParam)) {
  2. // Fallback ou prise en compte du paramètre 'id' si l'ID n'est pas dans le chemin
  3. $sessionId = $checkoutIdParam;
  4. }
  5. if ($method === 'POST' && ($hasCheckoutParam || strpos($path, '/checkout_sessions') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. if ($sessionId) {
  7. if ($hasCompleteParam || strpos($path, '/complete') !== false) {
  8. $validation = $CLICSHOPPING_getRetailers->validateAcpInput($input, 'complete', $input['items'] ?? []);
  9. if (!empty($validation)) {
  10. http_response_code(400);
  • gyakutsuki

    not included
  1. // Simple routing
  2. // --------------------------------------------------------------------------------
  3. // POST /agentic_commerce/delegate_payment - Handle delegated payment vaulting
  4. // --------------------------------------------------------------------------------
  5. if ($method === 'POST' && ($hasDelegatePaymentParam || strpos($path, '/agentic_commerce/delegate_payment') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. $headers = [
  7. 'idempotency_key' => $_SERVER['HTTP_IDEMPOTENCY_KEY'] ?? null,
  8. 'request_id' => $_SERVER['HTTP_REQUEST_ID'] ?? null
  9. ];
  10. $result = $CLICSHOPPING_getRetailers->handleDelegatePayment($input, $headers);
  • gyakutsuki

    not included
  1. exit;
  2. }
  3. // --------------------------------------------------------------------------------
  4. // POST /stripe_webhook - Handle Stripe webhooks
  5. // --------------------------------------------------------------------------------
  6. if ($method === 'POST' && ($hasStripeWebhookParam || strpos($path, '/stripe_webhook') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  7. $CLICSHOPPING_getRetailers->handleStripeWebhook();
  8. exit;
  9. }
  10. // --------------------------------------------------------------------------------
  • gyakutsuki

    not included
  1. // Simple routing
  2. // --------------------------------------------------------------------------------
  3. // GET /products - Returns product catalog
  4. // --------------------------------------------------------------------------------
  5. if ($method === 'GET' && ($hasProductsParam || strpos($path, '/products') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. // Return full product catalog
  7. $products = $CLICSHOPPING_getRetailers->getProducts();
  8. echo json_encode(['products' => $products], JSON_UNESCAPED_SLASHES);
  9. exit;
  • gyakutsuki

    not included
  1. // POST /create_order - Create ClicShopping order from session
  2. // --------------------------------------------------------------------------------
  3. $hasCreateOrderParam = isset($_GET['create_order']);
  4. $orderSessionIdParam = isset($_GET['session_id']) ? (string)$_GET['session_id'] : null;
  5. if ($method === 'POST' && ($hasCreateOrderParam || strpos($path, '/create_order') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. if (empty($orderSessionIdParam)) {
  7. http_response_code(400);
  8. echo json_encode(['error' => 'Session ID required']);
  9. exit;
  10. }
  • gyakutsuki

    not included
  1. } elseif (!empty($checkoutIdParam)) {
  2. // Fallback ou prise en compte du paramètre 'id' si l'ID n'est pas dans le chemin
  3. $sessionId = $checkoutIdParam;
  4. }
  5. if ($method === 'POST' && ($hasCheckoutParam || strpos($path, '/checkout_sessions') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. if ($sessionId) {
  7. // Completion: POST /checkout_sessions/{id}
  8. // Choose Delegated Payment or Stripe based on payload
  9. if (!empty($input['delegated_payment'])) {
  10. $session = $CLICSHOPPING_getRetailers->completeSessionWithDelegatedPayment($sessionId, $input);
  • gyakutsuki

    not included
  1. // POST /complete_and_order - Complete session then create order
  2. // --------------------------------------------------------------------------------
  3. $hasCompleteAndOrderParam = isset($_GET['complete_and_order']);
  4. $completeSessionIdParam = isset($_GET['session_id']) ? (string)$_GET['session_id'] : null;
  5. if ($method === 'POST' && ($hasCompleteAndOrderParam || strpos($path, '/complete_and_order') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. if (empty($completeSessionIdParam)) {
  7. http_response_code(400);
  8. echo json_encode(['error' => 'Session ID required']);
  9. exit;
  10. }
  • gyakutsuki

    not included
  1. exit;
  2. }
  3. // --------------------------------------------------------------------------------
  4. // POST /stripe_webhook - Handle Stripe webhooks
  5. // --------------------------------------------------------------------------------
  6. if ($method === 'POST' && ($hasStripeWebhookParam || strpos($path, '/stripe_webhook') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  7. $CLICSHOPPING_getRetailers->handleStripeWebhook();
  8. exit;
  9. }
  10. // --------------------------------------------------------------------------------
  • gyakutsuki

    not included
  1. 'action' => 'products'
  2. ]);
  3. exit;
  4. }
  5. if ($method === 'POST' && ($hasCheckoutParam || strpos($path, '/checkout_sessions') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. if (($hasCompleteParam || strpos($path, '/complete') !== false) && (($checkoutIdParam !== null) || preg_match('#/checkout_sessions/([^/]+)/complete#', $path, $matches))) {
  7. $sessionId = $checkoutIdParam ?? $matches[1] ?? null;
  8. if (!$sessionId) {
  9. $errorResponse('VALIDATION_ERROR', 'Missing session id');
  10. }
  • gyakutsuki

    not included
  1. ]);
  2. exit;
  3. }
  4. if ($method === 'POST' && ($hasCheckoutParam || strpos($path, '/checkout_sessions') !== false)) {
  5. if (($hasCompleteParam || strpos($path, '/complete') !== false) && (($checkoutIdParam !== null) || preg_match('#/checkout_sessions/([^/]+)/complete#', $path, $matches))) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. $sessionId = $checkoutIdParam ?? $matches[1] ?? null;
  7. if (!$sessionId) {
  8. $errorResponse('VALIDATION_ERROR', 'Missing session id');
  9. }
  10. $result = $ucp->completeSession($sessionId, $input);
  • gyakutsuki

    not included
  1. $hasCheckoutParam = isset($_GET['checkout_sessions']) || isset($_GET['retailers/checkout_sessions']);
  2. $checkoutIdParam = isset($_GET['id']) ? (string)$_GET['id'] : null;
  3. $hasCompleteParam = isset($_GET['complete']);
  4. $hasWebhookParam = isset($_GET['webhook']);
  5. if ($method === 'GET' && ($hasProductsParam || strpos($path, '/products') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. $filters = [
  7. 'page' => $_GET['page'] ?? 1,
  8. 'limit' => $_GET['limit'] ?? 100,
  9. 'category' => $_GET['category'] ?? null,
  10. 'min_price' => $_GET['min_price'] ?? null,
  • gyakutsuki

    not included
  1. 'action' => 'checkout_sessions.update'
  2. ]);
  3. exit;
  4. }
  5. if ($method === 'POST' && ($hasWebhookParam || strpos($path, '/webhook') !== false)) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. $result = $ucp->handleWebhook($input);
  7. echo json_encode($result, JSON_UNESCAPED_SLASHES);
  8. $logger->info('UCP response', [
  9. 'request_id' => $requestId,
  10. 'status' => 200,
  • gyakutsuki

    not included
  1. ];
  2. }
  3. }
  4. for ($i = 0, $n = \count($include_modules); $i < $n; $i++) {
  5. if (strpos($include_modules[$i]['class'], '\\') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  6. Registry::set('Shipping_' . str_replace('\\', '_', $include_modules[$i]['class']), new $include_modules[$i]['file']);
  7. $module = Registry::get('Shipping_' . str_replace('\\', '_', $include_modules[$i]['class']));
  8. ?>
  9. <div class="row">
  10. <div class="col-md-12">
  • gyakutsuki

    not included
  1. $modules_payment = explode(';', $Qconfiguration_payment->value('configuration_value'));
  2. $include_modules = [];
  3. foreach ($modules_payment as $value) {
  4. if (strpos($value, '\\') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  5. $class = Apps::getModuleClass($value, 'Payment');
  6. $include_modules[] = ['class' => $value,
  7. 'file' => $class
  8. ];
  • gyakutsuki

    not included
  1. ];
  2. }
  3. }
  4. for ($i = 0, $n = \count($include_modules); $i < $n; $i++) {
  5. if (strpos($include_modules[$i]['class'], '\\') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  6. Registry::set('Payment_' . str_replace('\\', '_', $include_modules[$i]['class']), new $include_modules[$i]['file']);
  7. $module = Registry::get('Payment_' . str_replace('\\', '_', $include_modules[$i]['class']));
  8. ?>
  9. <div class="row">
  10. <div class="col-md-12">
  • gyakutsuki

    not included
  1. $modules_shipping = explode(';', $Qconfiguration_shipping->value('configuration_value'));
  2. $include_modules = [];
  3. foreach ($modules_shipping as $value) {
  4. if (strpos($value, '\\') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  5. $class = Apps::getModuleClass($value, 'Shipping');
  6. $include_modules[] = ['class' => $value,
  7. 'file' => $class
  8. ];
  • gyakutsuki

    not included
  1. if ((substr($spider, strlen($spider) - 1, 1) == ' ') || (substr($spider, strlen($spider) - 1, 1) == "\n")) {
  2. $spider = substr($spider, 0, strlen($spider) - 1);
  3. }
  4. if (!empty($spider)) {
  5. if (strpos($user_agent, $spider) !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  6. $parameters['can_start'] = false;
  7. break;
  8. }
  9. }
  10. }
  • gyakutsuki

    not included
  1. $content = file($spiders_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
  2. foreach ($content as $line) {
  3. $line = trim($line);
  4. // Ignore empty lines and comments starting with '#'
  5. if (!empty($line) && strpos($line, '#') !== 0) {
    Consider replacing strpos() with str_starts_with() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. $spiders_array[] = strtolower($line);
  7. }
  8. }
  9. // Save processed list to cache for future requests
  • gyakutsuki

    not included
  1. 'text' => $Qproducts->valueInt('customers_basket_quantity') . ' x ' . $Qproducts->value('products_name')
  2. ];
  3. $attributes = [];
  4. if (strpos($Qproducts->valueInt('products_id'), '{') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  5. $combos = [];
  6. preg_match_all('/(\{[0-9]+\}[0-9]+){1}/', $Qproducts->valueInt('products_id'), $combos);
  7. foreach ($combos[0] as $combo) {
  8. $att = [];
  • gyakutsuki

    not included
  1. while ($Qcols->fetch()) {
  2. if ($Qcols->hasValue('Collation') && !\is_null($Qcols->value('Collation'))) {
  3. // Skip VECTOR columns - they are binary data and cannot be converted to UTF8
  4. $columnType = strtolower($Qcols->value('Type'));
  5. if (strpos($columnType, 'vector') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by clicshopping
  6. continue;
  7. }
  8. if ($_POST['from_charset'] == 'auto') {
  9. $old_charset = substr($Qcols->value('Collation'), 0, strpos($Qcols->value('Collation'), '_'));
  • gyakutsuki

    not included
  1. $module_key = $CLICSHOPPING_CfgModule->get($set, 'key');
  2. $appModuleType = $CLICSHOPPING_ModulesAdmin->getSwitchModules($module_type);
  3. if (strpos($_GET['module'], '\\') !== false) {
    Consider replacing strpos() with str_contains() for improved readability.
    Time to fix: about 1 hour
    Read doc Permalink Copy Prompt
    Last edited by ClicShopping
  4. $class = Apps::getModuleClass($_GET['module'], $appModuleType);
  5. if (class_exists($class)) {
  6. $file_extension = '';
  7. $module = new $class();
  • gyakutsuki

    not included