From: Michael Wallner Date: Tue, 14 May 2013 11:12:44 +0000 (+0200) Subject: always provide a property zval X-Git-Tag: v0.4.0~6 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=63e95273b8e037447fa18e9628bc176ac6ca1f6a;p=m6w6%2Fext-pq always provide a property zval --- diff --git a/src/php_pq_object.c b/src/php_pq_object.c index e6640de..ecfbbf7 100644 --- a/src/php_pq_object.c +++ b/src/php_pq_object.c @@ -115,18 +115,18 @@ zval *php_pq_object_read_prop(zval *object, zval *member, int type, const zend_l if (!obj->intern) { zend_error(E_WARNING, "%s not initialized", ancestor(obj->zo.ce)->name); - } else if ((SUCCESS == zend_hash_find(obj->prophandler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void *) &handler)) && handler->read) { - if (type == BP_VAR_R) { - ALLOC_ZVAL(return_value); - Z_SET_REFCOUNT_P(return_value, 0); - Z_UNSET_ISREF_P(return_value); - - handler->read(object, obj, return_value TSRMLS_CC); - } else { - zend_error(E_ERROR, "Cannot access %s properties by reference or array key/index", ancestor(obj->zo.ce)->name); - } - } else { return_value = zend_get_std_object_handlers()->read_property(object, member, type, key TSRMLS_CC); + } else if ((SUCCESS != zend_hash_find(obj->prophandler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void *) &handler)) || !handler->read) { + return_value = zend_get_std_object_handlers()->read_property(object, member, type, key TSRMLS_CC); + } else if (type != BP_VAR_R) { + zend_error(E_ERROR, "Cannot access %s properties by reference or array key/index", ancestor(obj->zo.ce)->name); + return_value = zend_get_std_object_handlers()->read_property(object, member, type, key TSRMLS_CC); + } else { + ALLOC_ZVAL(return_value); + Z_SET_REFCOUNT_P(return_value, 0); + Z_UNSET_ISREF_P(return_value); + + handler->read(object, obj, return_value TSRMLS_CC); } return return_value;