Fix is_callable $callable_name for anon class methods#2381
Closed
adsr wants to merge 2 commits intophp:masterfrom
Closed
Fix is_callable $callable_name for anon class methods#2381adsr wants to merge 2 commits intophp:masterfrom
is_callable $callable_name for anon class methods#2381adsr wants to merge 2 commits intophp:masterfrom
Conversation
Member
|
I'd be in favor of just always returning the name as-is. As the comment indicates, the current implementation was just used because it happened to be how PHP 5 behaved (by accident, not by design). Now that there is a specific reason why this behavior is not desirable, we should just drop it. |
Contributor
Author
|
If nothing relies on the truncating behavior, that sounds good to me. I will change tests and update PR. |
Member
|
Merged via 7e5cf2a, thanks! |
Member
|
Also made run-tests fail on BORKED tests in 981c587. The Travis build should not have been passing on this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes bug https://bugs.php.net/bug.php?id=73118
This patch aims to make
is_callablereturn a usable$callable_namefor anonymous class methods. Anon class methods are formatted like......where
\x00is a null-char. The current behavior is to return just "class@anonymous" which is unusable as a function ref, e.g., as a parameter tocall_user_func.I attempt to preserve back-compat by only returning the full callable name (including null-char) when the function actually exists (retval is TRUE and
$syntax_onlyis FALSE).Open to suggestions if someone can think of a cleaner way.
EDIT: See nikic's comment below and new commit.