Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
other
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Mar 2021 at 15:13 UTC
Updated:
15 Apr 2021 at 09:49 UTC
Jump to comment: Most recent
D7 tests with PHP 8.0 currently hit these failures:
Drupal error handlers 22 passes, 8 fails, and 0 exceptions
The test class is: Drupal error handlers (DrupalErrorHandlerTestCase)
Looking at e.g. https://www.drupal.org/pift-ci-job/2017309 the failures are:
testErrorHandler
fail: [Browser] Line 45 of modules/simpletest/tests/error.test:
Received expected HTTP status code.
fail: [Other] Line 46 of modules/simpletest/tests/error.test:
Found error message: Notice: Undefined variable: bananas in error_test_generate_warnings() (line .
fail: [Other] Line 47 of modules/simpletest/tests/error.test:
Found error message: Warning: Division by zero in error_test_generate_warnings() (line .
fail: [Other] Line 48 of modules/simpletest/tests/error.test:
Found error message: User warning: Drupal is awesome in error_test_generate_warnings() (line .
fail: [Browser] Line 53 of modules/simpletest/tests/error.test:
Received expected HTTP status code.
fail: [Other] Line 55 of modules/simpletest/tests/error.test:
Found error message: Warning: Division by zero in error_test_generate_warnings() (line .
fail: [Other] Line 56 of modules/simpletest/tests/error.test:
Found error message: User warning: Drupal is awesome in error_test_generate_warnings() (line .
fail: [Browser] Line 61 of modules/simpletest/tests/error.test:
Received expected HTTP status code.
Fix failing tests.
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 #2
mcdruid commentedComment #3
mcdruid commentedComment #4
mcdruid commentedComment #7
taran2lThis issue as well as #3206430: [PHP 8] test failures in SimpleTest functionality are both rely on the same piece of code in
error_test.module. Thus, I suggest fixing both here.The main issue here is the tests doing checks that are not true anymore in PHP8+, mostly due to the fact that a lot of things are being converted to exceptions, some are "promoted" to a different severity.
One by one:
DivisionByZeroErrorexceptionTypeErrororArgumentCountErrorexceptionsBasically, I've copied code that produces PHP notices/warnings across PHP5.3 - 8.0 from D8 (looking for the issue ...)
Comment #8
taran2lthis piece does not work in PHP 5.3 and PHP5.4.0-5.4.6, probably a better warning generating issue is needed
Also, I'm not sure about
as it does produce 3 PHP warnings, not 1 ...
Does anyone have a better example?
Comment #9
taran2lSo, thanks to @chmez, figured out a piece of code that produces a PHP warning across all the supported versions (except the message is not the same, but I think we can leave with it):
.. a PHP function that generates a single warning is still to do
Comment #10
taran2lBut in the end, it does matter that all warnings are being caught not their number
Comment #11
mcdruid commentedThis looks pretty good.
I am wondering whether we'd be better to leave the existing code in place and have new versions of everything for PHP 8 and above... but if you've managed to find examples that produce the appropriate warnings/notices etc.. right back to PHP 5.3 perhaps we don't need to add messy logic to keep the old code.
Maybe I'd just be sad to say goodbye to the monkeys and their $bananas :)
I might have a quick look at how ugly it'd get to branch differently for PHP 8, but generally it looks like you've done a good job of updating everything.
Comment #14
mcdruid commentedDiscussed with @Fabianx who was happy with these changes.
Sorry monkeys :)
Comment #16
mcdruid commentedExcellent - so that's PHP 8 tests passing.
Thank you everyone!