Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Nov 2018 at 02:22 UTC
Updated:
26 Apr 2021 at 13:16 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
benjifisherI think I ran into this with Drupal 8, but I am not sure how to reproduce the problem. I noticed #2947291: Missing argument 5 for _drupal_error_handler(), and @catch suggested filing a new issue for Drupal 7, so here it is. I used the text from the Drupal 8 issue for the issue description here.
Comment #3
benjifisherLooking at the patch that was committed for Drupal 8, I think this issue is appropriate for a novice, so I am adding the appropriate tag.
Comment #4
pounardPatch here: https://www.drupal.org/files/issues/2947291-9-_drupal_error_handler-sign...
Comment #5
ajaybmishra commentedCorrected drupal 7 error handler signature with default values for function parameters, also updated Parameters comment section with "Optional" keyword.
Patch attached.
Comment #6
benjifisher@ajaybmishra25:
Thanks for the patch!
The patch in #2947291: Missing argument 5 for _drupal_error_handler() (the Drupal 8 version of this issue) uses
NULLfor the default values:I think that is pretty standard in PHP, so that callers know they can set, for example
$line = NULLif they want the default value of that variable and need to specify a non-default$context.Your patch uses three different default values:
Is there any reason you chose not to use
NULLas in the version of the patch for Drupal 8?I am setting the status to "Needs work", but that work could be either an updated patch or a comment explaining why the Drupal 7 version should be different from the Drupal 8 version.
Comment #7
ajaybmishra commentedHello benjifisher,
Thanks for your guidance in right path.
Actually I tried to set default values based on the type of value that parameter expects, so that callers must know what value they must set.
As we have to follow Drupal 8 coding standard, so we must change the default values to NULL, I am updating the patch.
Comment #8
ajaybmishra commentedHello benjifisher,
I have updated the patch file with changes suggested, please review.
Comment #10
ajaybmishra commentedHello benjifisher,
Corrected the patch, please review.
Comment #12
ajaybmishra commentedHello,
Corrected the failed patch, please review.
Comment #14
mr.baileys@ajaybmishra25: the most recent patch you provided is against your previous change/patch, not against 7.x-dev, which is why it fails to apply.
Comment #15
ajaybmishra commentedHi mr.baileys,
Thanks for help, yes i am working on it.
Comment #16
singhkiran commentedAs per me , this is the correct way .
Comment #17
msankhala commentedLine length increasing 80 characters. As per Drupal API documentation and comment standards:
see https://www.drupal.org/docs/develop/standards/api-documentation-and-comm...
Comment #18
singhkiran commentedI have fixed coding standard .
Comment #20
msankhala commentedLooks like the issue is with test bot, not with this patch.
Comment #21
msankhala commentedTests have passed so I am moving it to RTBC. Looks good to me.
Comment #22
ajaybmishra commentedHello singhkiran,
You missed to correct coding standard in below function, which was added earlier in patch no. 5.
_drupal_error_handler_real
I am correcting this patch, please find the attached patch.
Comment #23
benjifisher@ajaybmishra25:
Please use the comment number (the expected number of the comment you are adding) as the last part of the patch filename. Instead of
-10.patchfor your most recent patch, that would have been-22.patch. Every so often, someone else adds a comment just before you do, and the number may be off, but it makes it easier to match the patches to the corresponding comments.I see two differences between the patch in #22 and the one in #18:
_drupal_error_handler_real()as well as to_drupal_error_handler().As I said in #6, we should avoid unnecessary differences between Drupal 7 and Drupal 8. On both points, the patch in #18 wins. In fact, that patch is almost identical to the patch that was committed to Drupal 8 (from #11, not #9, in #2947291: Missing argument 5 for _drupal_error_handler()). The only differences are the filename (
core/includes/bootstrap.phpin D8,includes/bootstrap.phpin D7) and the change requested in #17.There is no need to change the parameters to
_drupal_error_handler_real(), since it should only be called by_drupal_error_handler(), which already supplies the parameters. I am not sure why you refer to this as a problem with coding standards.I will re-upload @singhkiran's patch from #18 and restore the status of this issue to RTBC.
Comment #24
mulambo commented#18 seems like a win to me. In D8 it is almost identical (path is different and last doc param has word 'the' on different line).
It also resolves issue with D7 not working on PHP 8, since 5th parameter in error_handler is deprecated since PHP 7.2 (https://www.php.net/manual/en/function.set-error-handler.php) and removed in PHP 8.
Comment #25
mulambo commentedFixed in #3200407
Comment #26
benjifisher@Mulambo:
Thanks for updating this issue. I think the correct status is Closed (duplicate) instead of Fixed.
I will add credit to #3200407: [PHP8] ArgumentCountError: Too few arguments to function _drupal_error_handler() and friends for some of thepeople who participated on this issue.