com php-src: fix test case given by dmitry ...: Zend/zend_exe cute.c
| From: | Bob Weinand | Date: | Wed, 06 Apr 2016 19:19:21 +0000 |
| Subject: | com php-src: fix test case given by dmitry ...: Zend/zend_exe cute.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95572@lists.php.net to get a copy of this message | ||
Commit: e8bac369d2b8e65cc6b374a9dded6a5c41cb1798
Author: Joe Watkins <krakjoe@php.net> Wed, 6 Apr 2016 20:19:21 +0100
Parents: 2181b0ef5f83ee07d52762e5c0ff7ebd400c58a5
Branches: typed_ref_properties
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e8bac369d2b8e65cc6b374a9dded6a5c41cb1798
Log:
fix test case given by dmitry ...
Changed paths:
M Zend/zend_execute.c
Diff:
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index e1f987e..8906b05 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1403,7 +1403,28 @@ static zend_never_inline void zend_post_incdec_overloaded_property(zval
*object,
} else {
ZVAL_COPY(result, z);
}
+
+ if (ZEND_CLASS_HAS_TYPE_HINTS(Z_OBJCE_P(object)) && Z_TYPE_P(property) == IS_STRING) {
+ zend_property_info *prop_info = zend_object_fetch_property_type_info_ex(object,
Z_STR_P(property), cache_slot);
+
+ if (prop_info) {
+ if (Z_TYPE_P(result) == IS_NULL) {
+ zend_throw_exception_ex(zend_ce_type_error, prop_info->type,
+ "Typed property %s::$%s must not be accessed before initialization",
+ ZSTR_VAL(prop_info->ce->name),
+ Z_STRVAL_P(property));
+ OBJ_RELEASE(Z_OBJ(obj));
+ zval_ptr_dtor(z);
+ return;
+ } else if (!zend_verify_property_type(prop_info, result,
ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)))) {
+ zend_verify_property_type_error(prop_info, Z_STR_P(property), result);
+ return;
+ }
+ }
+ }
+
ZVAL_DUP(&z_copy, result);
+
if (inc) {
increment_function(&z_copy);
} else {