diff -u b/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module --- b/modules/simpletest/simpletest.module +++ b/modules/simpletest/simpletest.module @@ -371,7 +371,7 @@ // If this test class requires a non-existing module, skip it. if (!empty($info['dependencies'])) { - // Searching for an item that does not exist returns NULL. + // Searching for an item that does not exist triggers an PHP error. // Set a custom error handler so we can ignore the file not found error. set_error_handler(function($error_level, $message, $filename, $line, $context) { // Skip error handling if this is a "file not found" error. @@ -383,6 +383,8 @@ foreach ($info['dependencies'] as $module) { if (!drupal_get_filename('module', $module)) { + // Restore the original error handler. + restore_error_handler(); continue 2; } } diff -u b/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test --- b/modules/simpletest/tests/bootstrap.test +++ b/modules/simpletest/tests/bootstrap.test @@ -435,10 +435,10 @@ restore_error_handler(); // Get the bad records static from drupal_get_filename. - $bad = &drupal_static('drupal_get_filename:missing'); + $missing = &drupal_static('drupal_get_filename:missing'); // Searching for an item that does not exist creates a static record in drupal_get_filename. - $this->assertTrue($bad['module'][$non_existing_module], 'Searching for an item that does not exist creates a static record in drupal_get_filename.'); + $this->assertTrue($missing['module'][$non_existing_module], 'Searching for an item that does not exist creates a static record in drupal_get_filename.'); } }