zend_get_property_info takes a zend_string* now

This commit is contained in:
Nikita Popov 2014-09-13 23:14:04 +02:00
parent 734d0b6bfd
commit ebc6da5628
5 changed files with 9 additions and 12 deletions

View file

@ -1268,13 +1268,12 @@ ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properti
{ {
object->properties = properties; object->properties = properties;
if (object->ce->default_properties_count) { if (object->ce->default_properties_count) {
zval *prop, tmp; zval *prop;
zend_string *key; zend_string *key;
zend_property_info *property_info; zend_property_info *property_info;
ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) { ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) {
ZVAL_STR(&tmp, key); property_info = zend_get_property_info(object->ce, key, 1 TSRMLS_CC);
property_info = zend_get_property_info(object->ce, &tmp, 1 TSRMLS_CC);
if (property_info && if (property_info &&
(property_info->flags & ZEND_ACC_STATIC) == 0 && (property_info->flags & ZEND_ACC_STATIC) == 0 &&
property_info->offset >= 0) { property_info->offset >= 0) {
@ -1293,8 +1292,7 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties
zend_property_info *property_info; zend_property_info *property_info;
ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) { ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) {
ZVAL_STR(&tmp, key); property_info = zend_get_property_info(object->ce, key, 1 TSRMLS_CC);
property_info = zend_get_property_info(object->ce, &tmp, 1 TSRMLS_CC);
if (property_info && if (property_info &&
(property_info->flags & ZEND_ACC_STATIC) == 0 && (property_info->flags & ZEND_ACC_STATIC) == 0 &&
property_info->offset >= 0) { property_info->offset >= 0) {

View file

@ -385,9 +385,9 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui
} }
/* }}} */ /* }}} */
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC) /* {{{ */ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent TSRMLS_DC) /* {{{ */
{ {
return zend_get_property_info_quick(ce, Z_STR_P(member), silent, NULL TSRMLS_CC); return zend_get_property_info_quick(ce, member, silent, NULL TSRMLS_CC);
} }
/* }}} */ /* }}} */

View file

@ -159,7 +159,7 @@ ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce,
ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, void **cache_slot TSRMLS_DC); ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent, void **cache_slot TSRMLS_DC);
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, void **cache_slot TSRMLS_DC); ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name, void **cache_slot TSRMLS_DC);
ZEND_API union _zend_function *zend_std_get_constructor(zend_object *object TSRMLS_DC); ZEND_API union _zend_function *zend_std_get_constructor(zend_object *object TSRMLS_DC);
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC); ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent TSRMLS_DC);
ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC); ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC);
ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC); ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp TSRMLS_DC);
ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC); ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC);

View file

@ -3906,7 +3906,7 @@ static int _adddynproperty(zval *ptr TSRMLS_DC, int num_args, va_list args, zend
{ {
zval property; zval property;
zend_class_entry *ce = *va_arg(args, zend_class_entry**); zend_class_entry *ce = *va_arg(args, zend_class_entry**);
zval *retval = va_arg(args, zval*), member; zval *retval = va_arg(args, zval*);
/* under some circumstances, the properties hash table may contain numeric /* under some circumstances, the properties hash table may contain numeric
* properties (e.g. when casting from array). This is a WONT FIX bug, at * properties (e.g. when casting from array). This is a WONT FIX bug, at
@ -3919,8 +3919,7 @@ static int _adddynproperty(zval *ptr TSRMLS_DC, int num_args, va_list args, zend
return 0; /* non public cannot be dynamic */ return 0; /* non public cannot be dynamic */
} }
ZVAL_STR(&member, hash_key->key); if (zend_get_property_info(ce, hash_key->key, 1 TSRMLS_CC) == &EG(std_property_info)) {
if (zend_get_property_info(ce, &member, 1 TSRMLS_CC) == &EG(std_property_info)) {
EG(std_property_info).flags = ZEND_ACC_IMPLICIT_PUBLIC; EG(std_property_info).flags = ZEND_ACC_IMPLICIT_PUBLIC;
reflection_property_factory(ce, &EG(std_property_info), &property TSRMLS_CC); reflection_property_factory(ce, &EG(std_property_info), &property TSRMLS_CC);
add_next_index_zval(retval, &property); add_next_index_zval(retval, &property);

View file

@ -1201,7 +1201,7 @@ static zval* get_zval_property(zval* object, char* name, zval *rv TSRMLS_DC)
/* Hack for bug #32455 */ /* Hack for bug #32455 */
zend_property_info *property_info; zend_property_info *property_info;
property_info = zend_get_property_info(Z_OBJCE_P(object), &member, 1 TSRMLS_CC); property_info = zend_get_property_info(Z_OBJCE_P(object), Z_STR(member), 1 TSRMLS_CC);
EG(scope) = old_scope; EG(scope) = old_scope;
if (property_info && zend_hash_exists(Z_OBJPROP_P(object), property_info->name)) { if (property_info && zend_hash_exists(Z_OBJPROP_P(object), property_info->name)) {
zval_ptr_dtor(&member); zval_ptr_dtor(&member);