Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
While testing a database driver on D9 I could not get this test to pass:
Testing Drupal\FunctionalTests\Bootstrap\UncaughtExceptionTest
Uncaught Exception (Drupal\FunctionalTests\Bootstrap\UncaughtException)
✔ Uncaught exception 14506 ms
✘ Uncaught fatal error 13735 ms
┐
├ Behat\Mink\Exception\ExpectationException: The string "'" was not found anywhere in the HTML response of the current page.
│
╵ /var/www/html/recommended-project/drupal9/recommended-project/vendor/behat/mink/src/WebAssert.php:794
╵ /var/www/html/recommended-project/drupal9/recommended-project/vendor/behat/mink/src/WebAssert.php:324
╵ /var/www/html/recommended-project/drupal9/recommended-project/web/core/tests/Drupal/Tests/WebAssert.php:524
╵ /var/www/html/recommended-project/drupal9/recommended-project/web/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php:108
╵ /var/www/html/recommended-project/drupal9/recommended-project/vendor/phpunit/phpunit/src/Framework/TestResult.php:726
┴
The backtrace looks like this:
96 23/May 20:47 php Error TypeError: Argument 1 passed to Drupal\error_test\Controller\ErrorTestController::Drupal\error_test\Controller\{closure}() must be of the type array,
string given, called in /var/www/html/recommended-project/drupal9/recommended-project/web/modules/error_test/src/Controller/ErrorTestController.php
on line 65 in Drupal\error_test\Controller\ErrorTestController->Drupal\error_test\Controller\{closure}() (line 62 of
/var/www/html/recommended-project/drupal9/recommended-project/web/modules/error_test/src/Controller/ErrorTestController.php) #0
/var/www/html/recommended-project/drupal9/recommended-project/web/modules/error_test/src/Controller/ErrorTestController.php(65):
Drupal\error_test\Controller\ErrorTestController->Drupal\error_test\Controller\{closure}()
#1 [internal function]: Drupal\error_test\Controller\ErrorTestController->generateFatals()
#2
/var/www/html/recommended-project/drupal9/recommended-project/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(
123): call_user_func_array()
#3 /var/www/html/recommended-project/drupal9/recommended-project/web/core/lib/Drupal/Core/Render/Renderer.php(564):
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#4
/var/www/html/recommended-project/drupal9/recommended-project/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(
124): Drupal\Core\Render\Renderer->executeInRenderContext()
#5
/var/www/html/recommended-project/drupal9/recommended-project/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(
97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#6 /var/www/html/recommended-project/drupal9/recommended-project/vendor/symfony/http-kernel/HttpKernel.php(158):
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#7 /var/www/html/recommended-project/drupal9/recommended-project/vendor/symfony/http-kernel/HttpKernel.php(80):
Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#8 /var/www/html/recommended-project/drupal9/recommended-project/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58):
Symfony\Component\HttpKernel\HttpKernel->handle()
#9 /var/www/html/recommended-project/drupal9/recommended-project/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48):
Drupal\Core\StackMiddleware\Session->handle()
#10 /var/www/html/recommended-project/drupal9/recommended-project/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106):
Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#11 /var/www/html/recommended-project/drupal9/recommended-project/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85):
Drupal\page_cache\StackMiddleware\PageCache->pass()
#12 /var/www/html/recommended-project/drupal9/recommended-project/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48):
Drupal\page_cache\StackMiddleware\PageCache->handle()
#13 /var/www/html/recommended-project/drupal9/recommended-project/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51):
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#14 /var/www/html/recommended-project/drupal9/recommended-project/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23):
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#15 /var/www/html/recommended-project/drupal9/recommended-project/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#16 /var/www/html/recommended-project/drupal9/recommended-project/web/index2.php(19): Drupal\Core\DrupalKernel->handle()
#17 /var/www/html/recommended-project/drupal9/recommended-project/web/index.php(11): require_once('/var/www/html/r...')
#18 {main}.
A simple require_once in index.php to an index2.php solved it ...
The real patch however is to just check for > instead of the apostrophe.
So what will work is:
diff --git a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php
index 126f8f34c1..f6a9f551ad 100644
--- a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php
+++ b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php
@@ -105,8 +105,8 @@ public function testUncaughtFatalError() {
$this->assertSession()->responseContains((string) $message);
$this->assertSession()->responseContains('<pre class="backtrace">');
// Ensure we are escaping but not double escaping.
- $this->assertSession()->responseContains(''');
- $this->assertSession()->responseNotContains('&#039;');
+ $this->assertSession()->responseContains('>');
+ $this->assertSession()->responseNotContains('&gt;');
}
/**
Novice tag only to provide a patch for this ...
Issue fork drupal-3281996
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
rpayanmComment #6
hlopez CreditAttribution: hlopez at Four Kitchens commentedThe changes look good.
Comment #8
catchJust changing the assertion to one that will work in both situations seems good, coverage level is the same.
Committed/pushed to 10.1.x, and cherry-picked back through to 9.4.x, thanks!