DrupalApcCache sets the prefix for the APCu keys it use using the value returned by drupal_valid_test_ua() or $GLOBALS['drupal_test_info']['test_run_id']

Created on 21 July 2024, 5 months ago
Updated 4 August 2024, 5 months ago

DrupalApcCache::__construct() contains the following code.

// When we are in testing mode we add the test prefix.
if ($test_prefix = drupal_valid_test_ua()) {
  $prefix = $test_prefix . '::' . $prefix;
}
elseif (isset($GLOBALS['drupal_test_info']['test_run_id'])) {
  $prefix = $GLOBALS['drupal_test_info']['test_run_id'] . '::' . $prefix;
}

$GLOBALS['drupal_test_info']['test_run_id'] is set with the value returned by drupal_valid_test_ua(), by _drupal_bootstrap_database().

if ($test_prefix = drupal_valid_test_ua()) {
    // Set the test run id for use in other parts of Drupal.
    $test_info =& $GLOBALS['drupal_test_info'];
    $test_info['test_run_id'] = $test_prefix;

    // …
}

If drupal_valid_test_ua() does not return any value, then $GLOBALS['drupal_test_info']['test_run_id'] won't be set.

The code must be changed not to use the value of $GLOBALS['drupal_test_info']['test_run_id'].

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇹Italy apaderno Brescia, 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024