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:
- It's not being used at all anyway
- Passing more parameters than expected will not trigger any issues in older PHP versions
- It's removed in D9 (see #3173888: Error handler signature changed in PHP 8)
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
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
Comment #3
taran2lWell, tests on PHP8.0 won't even start before certain things are fixed simultaneously ...
Comment #4
longwaveLooks simple enough.
Comment #5
ayesh commentedLGTM, thank you.
Comment #6
sjerdoAdded a few comments to the merge request regarding the function docblocks which still contain the $context parameter
Comment #7
taran2l@sjerdo, good catch.Back to needs review
Comment #8
longwaveWhoops, well spotted. Back to RTBC :)
Comment #9
mcdruid commentedComment #10
mcdruid commentedLGTM, thanks!
Comment #11
fabianx commentedRTBC + 1
Comment #13
mcdruid commentedThanks!
Comment #18
benjifisherI am transferring credit from the duplicate issue #3012167: Missing argument 5 for _drupal_error_handler() in Drupal 7.
Comment #19
DhirendraGrazitti commentedHi 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/
Comment #20
David Leonardo Trejos Cortés commentedHi 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