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

https://3v4l.org/AVtFS

$ 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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost created an issue. See original summary.

andypost’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
785 bytes

fixed RFC link and basic patch

andypost’s picture

andypost’s picture

FileSize
783 bytes

Valid patch

Status: Needs review » Needs work

The last submitted patch, 4: 3174158-4.patch, failed testing. View results

anmolgoyal74’s picture

Status: Needs work » Needs review
FileSize
1.7 KB
798 bytes

Removed the test for warning also.

Status: Needs review » Needs work

The last submitted patch, 6: 3174158-6.patch, failed testing. View results

anmolgoyal74’s picture

Status: Needs work » Needs review
FileSize
3.21 KB
1.65 KB

Status: Needs review » Needs work

The last submitted patch, 8: 3174158-8.patch, failed testing. View results

andypost’s picture

I think this checks could be done conditionally,
so for php < 8 the test will remain the same but for 8+ will change expectations

alexpott’s picture

Status: Needs work » Needs review
FileSize
1.54 KB

Here's something that generates a warning for PHP 7 and PHP 8... https://3v4l.org/rQjN0 let's use that.

Status: Needs review » Needs work

The last submitted patch, 11: 3174158-11.patch, failed testing. View results

alexpott’s picture

Status: Needs work » Needs review
FileSize
1.26 KB
2.8 KB
Krzysztof Domański’s picture

Status: Needs review » Reviewed & tested by the community

  • catch committed 9557448 on 9.1.x
    Issue #3174158 by anmolgoyal74, alexpott, andypost: Division by zero is...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 9557448 and pushed to 9.1.x. Thanks!

Status: Fixed » Closed (fixed)

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