fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
#endif
- property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__get != NULL), key TSRMLS_CC);
-
- if (UNEXPECTED(!property_info) ||
- ((EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
- property_info->offset >= 0) ?
- (zobj->properties ?
- ((retval = (zval**)zobj->properties_table[property_info->offset]) == NULL) :
- (*(retval = &zobj->properties_table[property_info->offset]) == NULL)) :
- (UNEXPECTED(!zobj->properties) ||
- UNEXPECTED(zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE)))) {
- zval *new_zval;
- zend_guard *guard;
-
- if (!zobj->ce->__get ||
- zend_get_property_guard(zobj, property_info, member, &guard) != SUCCESS ||
- (property_info && guard->in_get)) {
- /* we don't have access controls - will just add it */
- new_zval = &EG(uninitialized_zval);
-
- Z_ADDREF_P(new_zval);
- if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
- property_info->offset >= 0) {
- if (!zobj->properties) {
- zobj->properties_table[property_info->offset] = new_zval;
- retval = &zobj->properties_table[property_info->offset];
- } else if (zobj->properties_table[property_info->offset]) {
- *(zval**)zobj->properties_table[property_info->offset] = new_zval;
- retval = (zval**)zobj->properties_table[property_info->offset];
- } else {
- zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &new_zval, sizeof(zval *), (void**)&zobj->properties_table[property_info->offset]);
- retval = (zval**)zobj->properties_table[property_info->offset];
- }
- } else {
- if (!zobj->properties) {
- rebuild_object_properties(zobj);
- }
- zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &new_zval, sizeof(zval *), (void **) &retval);
- }
+ property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__get != NULL), cache_slot TSRMLS_CC);
- /* Notice is thrown after creation of the property, to avoid EG(std_property_info)
- * being overwritten in an error handler. */
- if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
- zend_error(E_NOTICE, "Undefined property: %s::$%s", zobj->ce->name, Z_STRVAL_P(member));
+ if (EXPECTED(property_info != NULL)) {
+ if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
+ property_info->offset >= 0) {
+ retval = &zobj->properties_table[property_info->offset];
+ if (Z_TYPE_P(retval) != IS_UNDEF) {
+ goto exit;
}
- /* we don't have access controls - will just add it */
- if(UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
- zend_error(E_NOTICE, "Undefined property: %s::$%s", zobj->ce->name->val, Z_STRVAL_P(member));
- }
+ } else if (UNEXPECTED(zobj->properties != NULL)) {
+ retval = zend_hash_find(zobj->properties, property_info->name);
+ if (retval) goto exit;
+ }
+ }
+
+ if (!zobj->ce->__get ||
+ (guard = zend_get_property_guard(zobj, property_info, member)) == NULL ||
+ (property_info && ((*guard) & IN_GET))) {
+
+ ZVAL_NULL(&tmp);
+ if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
+ property_info->offset >= 0) {
+ retval = &zobj->properties_table[property_info->offset];
+ ZVAL_NULL(retval);
} else {
- /* we do have getter - fail and let it try again with usual get/set */
- retval = NULL;
+ if (!zobj->properties) {
+ rebuild_object_properties(zobj);
+ }
+ retval = zend_hash_update(zobj->properties, property_info->name, &tmp);
+ }
++
++ /* Notice is thrown after creation of the property, to avoid EG(std_property_info)
++ * being overwritten in an error handler. */
++ if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
++ zend_error(E_NOTICE, "Undefined property: %s::$%s", zobj->ce->name->val, Z_STRVAL_P(member));
+ }
+ } else {
+ /* we do have getter - fail and let it try again with usual get/set */
+ retval = NULL;
}
- if (UNEXPECTED(member == &tmp_member)) {
- zval_dtor(member);
+
+exit:
+ if (UNEXPECTED(Z_TYPE(tmp_member) != IS_UNDEF)) {
+ zval_dtor(&tmp_member);
}
return retval;
}