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('&#039;');
-    $this->assertSession()->responseNotContains('&amp;#039;');
+    $this->assertSession()->responseContains('&gt;');
+    $this->assertSession()->responseNotContains('&amp;gt;');
   }
 
   /**

Novice tag only to provide a patch for this ...

Issue fork drupal-3281996

Command icon 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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Fabianx created an issue. See original summary.

rpayanm made their first commit to this issue’s fork.

rpayanm’s picture

Status: Active » Needs review

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

hlopez’s picture

Status: Needs review » Reviewed & tested by the community

The changes look good.

  • catch committed 22aa137 on 10.0.x
    Issue #3281996 by rpayanm, Fabianx: UncaughtExceptionTest is not working...
  • catch committed f23ca85 on 10.1.x
    Issue #3281996 by rpayanm, Fabianx: UncaughtExceptionTest is not working...
  • catch committed 42143de on 9.5.x
    Issue #3281996 by rpayanm, Fabianx: UncaughtExceptionTest is not working...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Just 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!

  • catch committed 69d923f on 9.4.x
    Issue #3281996 by rpayanm, Fabianx: UncaughtExceptionTest is not working...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.