Skip to content

Commit a9d3566

Browse files
committed
- Fix string compare in unicode mode
1 parent 53cf140 commit a9d3566

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ext/reflection/php_reflection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,15 +2027,15 @@ ZEND_METHOD(reflection_parameter, getClass)
20272027
* TODO: Think about moving these checks to the compiler or some sort of
20282028
* lint-mode.
20292029
*/
2030-
if (0 == strncmp(param->arg_info->class_name.v, "self", sizeof("self")- 1)) {
2030+
if (ZEND_U_EQUAL(ZEND_STR_TYPE, param->arg_info->class_name, param->arg_info->class_name_len, "self", sizeof("self")- 1)) {
20312031
zend_class_entry *ce= param->fptr->common.scope;
20322032
if (!ce) {
20332033
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
20342034
"Parameter uses 'self' as type hint but function is not a class member!");
20352035
return;
20362036
}
20372037
pce= &ce;
2038-
} else if (0 == strncmp(param->arg_info->class_name.v, "parent", sizeof("parent")- 1)) {
2038+
} else if (ZEND_U_EQUAL(ZEND_STR_TYPE, param->arg_info->class_name, param->arg_info->class_name_len, "parent", sizeof("parent")- 1)) {
20392039
zend_class_entry *ce= param->fptr->common.scope;
20402040
if (!ce) {
20412041
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,

ext/reflection/tests/bug39884.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ object(ReflectionClass)#4 (1) {
2020
["name"]=>
2121
string(13) "stubParamTest"
2222
}
23+
--UEXPECT--
24+
object(ReflectionClass)#4 (1) {
25+
[u"name"]=>
26+
unicode(13) "stubParamTest"
27+
}
28+

0 commit comments

Comments
 (0)