[PHP8] ArgumentCountError: Too few arguments to function _drupal_error_handler() and friends

Created on 25 February 2021, almost 4 years ago
Updated 3 August 2023, over 1 year ago

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

๐Ÿ› Bug report
Status

Fixed

Version

7.0 โšฐ๏ธ

Component
Baseย  โ†’

Last updated 2 days ago

Created by

๐Ÿ‡บ๐Ÿ‡ฆUkraine Taran2L Lviv

Live updates comments and jobs are added and updated live.
  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia DhirendraGrazitti

    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 /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc on line 2457 and exactly 5 expected in /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc:2311\nStack trace:\n#0 /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc(2457): _drupal_error_handler()\n#1 /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc(2457): require_once()\n#2 /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc(2238): _drupal_bootstrap_database()\n#3 /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc(2376): drupal_bootstrap()\n#4 /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc(2234): _drupal_bootstrap_page_cache()\n#5 /var/www/vhost/grzdemo/resourcecenter/index.php(19): drupal_bootstrap()\n#6 {main} in /var/www/vhost/grzdemo/resourcecenter/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 /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc on line 2457 and exactly 5 expected in /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc:2311\nStack trace:\n#0 /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc(2457): _drupal_error_handler()\n#1 /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc(2457): require_once()\n#2 /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc(2238): _drupal_bootstrap_database()\n#3 /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc(2376): drupal_bootstrap()\n#4 /var/www/vhost/grzdemo/resourcecenter/includes/bootstrap.inc(2234): _drupal_bootstrap_page_cache()\n#5 /var/www/vhost/grzdemo/resourcecenter/index.php(19): drupal_bootstrap()\n#6 {main} in /var/www/vhost/grzdemo/resourcecenter/includes/database/database.inc on line 187', referer:

  • ๐Ÿ‡จ๐Ÿ‡ดColombia David Leonardo Trejos Cortรฉs

    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

Production build 0.71.5 2024