Problem/Motivation

The fifth parameter to the error handle callback has been deprecated in PHP7.2 and removed in PHP8.0, thus an ArgumentCountError exception is being thrown"

Warning
This parameter has been DEPRECATED as of PHP 7.2.0, and REMOVED as of PHP 8.0.0. If your function defines this parameter without a default, an error of "too few arguments" will be raised when it is called.

See https://www.php.net/manual/en/function.set-error-handler.php

Steps to reproduce

Run test on PHP8.0

Proposed resolution

Remove the fifth parameter due to:

Remaining tasks

Provide a patch & review

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

None

Issue fork drupal-3200407

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:

Comments

Taran2L created an issue. See original summary.

taran2l’s picture

Status: Active » Needs review

Well, tests on PHP8.0 won't even start before certain things are fixed simultaneously ...

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Looks simple enough.

ayesh’s picture

LGTM, thank you.

sjerdo’s picture

Status: Reviewed & tested by the community » Needs work

Added a few comments to the merge request regarding the function docblocks which still contain the $context parameter

taran2l’s picture

Status: Needs work » Needs review

@sjerdo, good catch.Back to needs review

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Whoops, well spotted. Back to RTBC :)

mcdruid’s picture

mcdruid’s picture

Issue tags: +Pending Drupal 7 commit

LGTM, thanks!

fabianx’s picture

RTBC + 1

  • mcdruid committed 0f0a28a on 7.x authored by Taran2L
    Issue #3200407 by Taran2L, longwave, Ayesh, sjerdo: [PHP 8]...
mcdruid’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Pending Drupal 7 commit

Thanks!

Status: Fixed » Closed (fixed)

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

benjifisher’s picture

I am transferring credit from the duplicate issue #3012167: Missing argument 5 for _drupal_error_handler() in Drupal 7.

DhirendraGrazitti’s picture

Hi Friends,
I am trying to setup website on other server and got the error the website is in Drupal 7.28. Please help

Got error 'PHP message: PHP Fatal error: During inheritance of PDO: Uncaught ArgumentCountError: Too few arguments to function _drupal_error_handler(), 4 passed in/includes/bootstrap.inc on line 2457 and exactly 5 expected in includes/bootstrap.inc:2311\nStack trace:\n#0 includes/bootstrap.inc(2457): _drupal_error_handler()\n#1 includes/bootstrap.inc(2457): require_once()\n#2 includes/bootstrap.inc(2238): _drupal_bootstrap_database()\n#3 includes/bootstrap.inc(2376): drupal_bootstrap()\n#4 includes/bootstrap.inc(2234): _drupal_bootstrap_page_cache()\n#5 index.php(19): drupal_bootstrap()\n#6 {main} in includes/database/database.inc on line 187'
[Wed Feb 01 11:33:38.494046 2023] [proxy_fcgi:error] [pid 2048058] [client 112.196.45.10:55596] AH01071: Got error 'PHP message: PHP Fatal error: During inheritance of PDO: Uncaught ArgumentCountError: Too few arguments to function _drupal_error_handler(), 4 passed in includes/bootstrap.inc on line 2457 and exactly 5 expected in includes/bootstrap.inc:2311\nStack trace:\n#0 includes/bootstrap.inc(2457): _drupal_error_handler()\n#1 includes/bootstrap.inc(2457): require_once()\n#2 includes/bootstrap.inc(2238): _drupal_bootstrap_database()\n#3 includes/bootstrap.inc(2376): drupal_bootstrap()\n#4 includes/bootstrap.inc(2234): _drupal_bootstrap_page_cache()\n#5 /varindex.php(19): drupal_bootstrap()\n#6 {main} in /var/www/vhost/

David Leonardo Trejos Cortés’s picture

Hi friends I had this fatal error and I don´t know how to solve. Thank you

Additional uncaught exception thrown while handling exception.

Fatal error: Uncaught ArgumentCountError: Too few arguments to function _drupal_error_handler(), 4 passed in C:\xampp\htdocs\drupal\core\lib\Drupal\Component\Render\FormattableMarkup.php on line 91 and exactly 5 expected in C:\xampp\htdocs\drupal\core\includes\bootstrap.inc:540 Stack trace: #0 C:\xampp\htdocs\drupal\core\lib\Drupal\Component\Render\FormattableMarkup.php(91): _drupal_error_handler(8192, 'Creation of dyn...', 'C:\\xampp\\htdocs...', 91) #1 C:\xampp\htdocs\drupal\core\lib\Drupal\Component\Utility\SafeMarkup.php(94): Drupal\Component\Render\FormattableMarkup->__construct('%type: @message...', Array) #2 C:\xampp\htdocs\drupal\core\lib\Drupal\Core\Utility\Error.php(104): Drupal\Component\Utility\SafeMarkup::format('%type: @message...', Array) #3 C:\xampp\htdocs\drupal\core\includes\bootstrap.inc(587): Drupal\Core\Utility\Error::renderExceptionSafe(Object(ArgumentCountError)) #4 C:\xampp\htdocs\drupal\core\includes\bootstrap.inc(565): _drupal_exception_handler_additional(Object(ArgumentCountError), Object(ArgumentCountError)) #5 [internal function]: _drupal_exception_handler(Object(ArgumentCountError)) #6 {main} thrown in C:\xampp\htdocs\drupal\core\includes\bootstrap.inc on line 540