mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- Make ReflectionObject::hasProperty() recognize dynamically added props
This commit is contained in:
parent
a5c37f37b6
commit
c1e480d46e
2 changed files with 22 additions and 0 deletions
|
@ -2656,6 +2656,7 @@ ZEND_METHOD(reflection_class, hasProperty)
|
|||
zend_class_entry *ce;
|
||||
char *name;
|
||||
int name_len;
|
||||
zval *property;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
|
||||
|
@ -2666,6 +2667,16 @@ ZEND_METHOD(reflection_class, hasProperty)
|
|||
if (zend_hash_exists(&ce->properties_info, name, name_len + 1)) {
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
if (intern->obj && Z_OBJ_HANDLER_P(intern->obj, has_property))
|
||||
{
|
||||
MAKE_STD_ZVAL(property);
|
||||
ZVAL_STRINGL(property, name, name_len, 1);
|
||||
if (Z_OBJ_HANDLER_P(intern->obj, has_property)(intern->obj, property, 2 TSRMLS_CC)) {
|
||||
zval_ptr_dtor(&property);
|
||||
RETURN_TRUE;
|
||||
}
|
||||
zval_ptr_dtor(&property);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue