Skip to content

Conversation

@mvorisek
Copy link
Contributor

@mvorisek mvorisek commented Feb 7, 2023

class name is normalized in constructor, thus it cannot start with backslash and the detection if the backslash is thus not the first char is not needed

GET_REFLECTION_OBJECT_PTR(fptr);

zend_string *name = fptr->common.function_name;
const char *backslash = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the best/fastest function to detect if one char is present?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zend_memrchr likely already is the fastest way.

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable. Thank you!

@iluuu1994 iluuu1994 merged commit a11e9c9 into php:master Feb 11, 2023
@mvorisek mvorisek deleted the simplify_refl_start_backslash branch February 11, 2023 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants