Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
The RFC https://wiki.php.net/rfc/engine_warnings#division_by_zero changed division by zero to fatal error so dblog tests fails
In #3156885: Change \Drupal\error_test\Controller\ErrorTestController::generateWarnings() to throw E_NOTICE error compatible with PHP 8 the controller already changed but not enough
Steps to reproduce
$ php -v
PHP 8.0.0beta4 (cli) (built: Sep 17 2020 15:03:04) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.0.0beta4, Copyright (c), by Zend Technologies
/var/www/html/web $ php -r 'echo 1/0;'
PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in Command line code:1
Stack trace:
#0 {main}
thrown in Command line code on line 1
Fatal error: Uncaught DivisionByZeroError: Division by zero in Command line code:1
Stack trace:
#0 {main}
thrown in Command line code on line 1
Proposed resolution
Remove division by zero from controller
Remaining tasks
patch/review/commit
User interface changes
no
API changes
no
Data model changes
no
Release notes snippet
no
Comment | File | Size | Author |
---|---|---|---|
#13 | 3174158-13.patch | 2.8 KB | alexpott |
#13 | 11-13-interdiff.txt | 1.26 KB | alexpott |
#11 | 3174158-11.patch | 1.54 KB | alexpott |
#6 | interdiff-4_6.txt | 798 bytes | anmolgoyal74 |
#6 | 3174158-6.patch | 1.7 KB | anmolgoyal74 |
Comments
Comment #2
andypostfixed RFC link and basic patch
Comment #3
andypostComment #4
andypostValid patch
Comment #6
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedRemoved the test for warning also.
Comment #8
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commentedComment #10
andypostI think this checks could be done conditionally,
so for php < 8 the test will remain the same but for 8+ will change expectations
Comment #11
alexpottHere's something that generates a warning for PHP 7 and PHP 8... https://3v4l.org/rQjN0 let's use that.
Comment #13
alexpottComment #14
Krzysztof DomańskiComment #16
catchCommitted 9557448 and pushed to 9.1.x. Thanks!