Skip to content

Conversation

adsr
Copy link
Contributor

@adsr adsr commented Feb 11, 2017

Fixes bug https://bugs.php.net/bug.php?id=73118

This patch aims to make is_callable return a usable $callable_name for anonymous class methods. Anon class methods are formatted like...

class@anonymous\x00/path/to/script.php0xdeadbeef::funcName

...where \x00 is a null-char. The current behavior is to return just "class@anonymous" which is unusable as a function ref, e.g., as a parameter to call_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_only is FALSE).

Open to suggestions if someone can think of a cleaner way.

EDIT: See nikic's comment below and new commit.

@nikic
Copy link
Member

nikic commented Feb 11, 2017

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.

@adsr
Copy link
Contributor Author

adsr commented Feb 11, 2017

If nothing relies on the truncating behavior, that sounds good to me. I will change tests and update PR.

@nikic
Copy link
Member

nikic commented Feb 11, 2017

Merged via 7e5cf2a, thanks!

@nikic nikic closed this Feb 11, 2017
@nikic
Copy link
Member

nikic commented Feb 11, 2017

Also made run-tests fail on BORKED tests in 981c587. The Travis build should not have been passing on this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants