Skip to content

use zend_string_equals* APIs for string comparisons#21707

Open
LamentXU123 wants to merge 4 commits intophp:masterfrom
LamentXU123:refactor-4
Open

use zend_string_equals* APIs for string comparisons#21707
LamentXU123 wants to merge 4 commits intophp:masterfrom
LamentXU123:refactor-4

Conversation

@LamentXU123
Copy link
Copy Markdown
Contributor

use the zend_string APIs zend_string_equals* which are clearer, and can also do some pointer comparisons if the strings are interned for any reason.

@devnexen
Copy link
Copy Markdown
Member

your changes look correct ! but will let the code-owners decide about it.

/* we we're looking for a private prop but found a non private one of the same name */
return FAILURE;
} else if (strcmp(ZSTR_VAL(prop_info_name)+1, ZSTR_VAL(property_info->name)+1)) {
} else if (!zend_string_equals(prop_info_name, property_info->name)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Technically this changes behavior, i.e. it compares the entire string rather than just the class name. For context, private property names have the mangled format "\0class_name\0property_name". I'd probably revert this one.

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.

3 participants