Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Previous error handler not callable#32758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

@tweichart
Copy link

QA
Branch?4.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Previous calls to the$previousHandler would have resulted in a fatal error (see e.g. ln 512 in Kernel.php), as a boolean value was saved to the$previousHandler variable due to thedefined method. Check for method was left in place, now the actual error_handler method defined in thePHPUNIT_COMPOSER_INSTALL will be used in case of existence.
If-statement for resetting the error_handler was changed too, as there's no boolean in the variable anymore.
Apart from that areturn; was changed toreturn null; as it won't throw errors in various cases but return the same result as before.

Tobias Weichart added2 commitsJuly 26, 2019 12:38
* previous calls to the previousHandler would have resulted in a fatal error* boolean was saved to variable, which later would have been called in custom error_handler* left check for previous existing error_Handler* replaced result with the actually defined and callable error_handler function* replaced empty return statement by null
@tweicharttweichart changed the titleErrorhandler callablePrevious error handler not callableJul 26, 2019
@nicolas-grekasnicolas-grekas added this to thenext milestoneJul 26, 2019
@nicolas-grekas
Copy link
Member

I'm sorry I don't get it. Can you please provide a reproducer script/app where I could see the fatal error happening?

@fancyweb
Copy link
Contributor

fancyweb commentedJul 26, 2019
edited
Loading

IMHO,$previousHandler can betrue and then it never goes in thisset_error_handler or it equals the previous error handler (null or acallable).
So there is nothing to fix.

@tweichart
Copy link
Author

@nicolas-grekas I don't have a case or script where it fails, just having a look at the code reveals some sort of logic error here.

@fancyweb actually you could change the line
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false; simply toreturn false; and the 'problem' would be gone. I wanted to keep the original logic found here though, as I wasn't quite sure about the impact that the removal would have...

@nicolas-grekas
Copy link
Member

@tweichart ok thank for the feedback. To me, there is no bug here, things are as expected. If you can provide a script producing the fatal error you see, I'd be happy to be wrong.

fancyweb reacted with thumbs up emoji

@fancyweb
Copy link
Contributor

fancyweb commentedJul 26, 2019
edited
Loading

@tweichart cfhttps://3v4l.org/vYo1c

$previousHandler in the error handler will always be equals to the previous error handler, thusnull or acallable.

PHPStorm reports that it's abool but it's a wrong static analysis.

@tweichart
Copy link
Author

@fancyweb yes you're right, the$previousHandler($type, $message, $file, $line) will never be called. so a more proper fix would be to replace the return statement by a simplereturn false;, isn't it?
If it's ok to leave unused calls in the code it's fine with me, just wanted to clean up ;-)

@fancyweb
Copy link
Contributor

It can be called if there is a previous error handler (uncomment theset_error_handler(function () {});) in my previous link.

@xabbuh
Copy link
Member

Even if it doesn't look so obvious, I am convinced that the current code works as expected. However, I have opened#32760 to rearrange some code that makes this more clear. What do you think?

@nicolas-grekas
Copy link
Member

Thanks@xabbuh
@tweichart please have a look at#32760 which provides the same logic as the current one, in a more readable way.

fabpot added a commit that referenced this pull requestJul 27, 2019
This PR was merged into the 4.2 branch.Discussion----------[HttpKernel] clarify error handler restoring process| Q             | A| ------------- | ---| Branch?       | 4.2| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#32758| License       | MIT| Doc PR        |Commits-------c1349d1 clarify error handler restoring process
@tweicharttweichart deleted the errorhandler_callable branchJuly 30, 2019 08:41
@nicolas-grekasnicolas-grekas modified the milestones:next,4.4Oct 27, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

5 participants

@tweichart@nicolas-grekas@fancyweb@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp