Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It happens when using external libraries that at some point, run the error handler manually (in my case it happens with Symfony, but it could happen with any library playing a bit with error handlers).
A very simple solution is make the 5th argument optional providing a default value.
Comment | File | Size | Author |
---|---|---|---|
#11 | Missing_argument_5_drupal_error_handler-D8-2947291-11.patch | 1.04 KB | markus_petrux |
#9 | 2947291-9-_drupal_error_handler-signature.patch | 1.47 KB | pounard |
#2 | 2947291-1-_drupal_error_handler-5th_argument.patch | 840 bytes | pounard |
Comments
Comment #2
pounardComment #3
joseph.olstadprobably should use the 5.3 syntax for array instead of [] that breaks on 5.3
Comment #4
joseph.olstadwith that said, 5.3 support should probably be removed completely from 7.x core. php 7 is what my servers are using
Comment #5
joseph.olstadso ya, probably ignore my comment #3
Comment #7
pounardTest failures don't seem to be related, I requeued for testing to be sure.
Comment #8
pounardIn fact, Drupal error handler does not respect the PHP error handler signature, all 3 last parameters must be optional: https://secure.php.net/manual/en/function.set-error-handler.php
Comment #9
pounardHere is an appropriate patch that respects Drupal coding conventions and should pass all tests (I hope).
Comment #10
markus_petrux CreditAttribution: markus_petrux commentedThis is also happening un Drupal 8.6 with PHP 7.1, symfony/http-foundation v3.4.17
Comment #11
markus_petrux CreditAttribution: markus_petrux commentedAttached patch for Drupal 8.7.x
It just changes the Drupal error handler with optional arguments those that are documented as optional in php manual. Also note the 5th argument is deprecated in 7.2
http://php.net/set_error_handler
Comment #12
interdruper CreditAttribution: interdruper at Interdruper commented#9 / #11 work for me. Thanks.
Comment #14
volegerComment #15
pounardThis patch is trivial, there is no possible side effect, it's a one liner, reasons are well documented, and it fixes real bugs from real life. There is no reason this isn't commited yet. It should have been commited on both Drupal 7 and 8 at least 6 months ago, and it would have been shipped in stable releases already.
Comment #16
catchCommitted and pushed 4af96a6a7e to 8.7.x and 0bc2447558 to 8.6.x. Thanks!
Comment #19
pounard@catch, thank you very much. Now only Drupal 7 is missing :)
Comment #20
catchThis could use a new issue for Drupal 7, linking back to this one.
Comment #21
benjifisherI just added #3012167: Missing argument 5 for _drupal_error_handler() in Drupal 7.