com php-src: Don't mess NULL and UNDEF default value back and force. Set proper value in first place.: Zend/zend_API.c Zend/zend _compile.c
| From: | Bob Weinand | Date: | Fri, 27 May 2016 09:35:24 +0000 |
| Subject: | com php-src: Don't mess NULL and UNDEF default value back and force. Set proper value in first place.: Zend/zend_API.c Zend/zend _compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95503@lists.php.net to get a copy of this message | ||
Commit: 5811e86f02026be862e758f02772dd2870f0a6d5
Author: Dmitry Stogov <dmitry@zend.com> Fri, 27 May 2016 12:35:24 +0300
Parents: 6bb1fa9b94fdcd563ed1d11af079051ea3a61023
Branches: typed_ref_properties
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5811e86f02026be862e758f02772dd2870f0a6d5
Log:
Don't mess NULL and UNDEF default value back and force. Set proper value in first place.
Changed paths:
M Zend/zend_API.c
M Zend/zend_compile.c
Diff:
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 379f8c4..289b1b3 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -3655,10 +3655,6 @@ ZEND_API int zend_declare_typed_property(zend_class_entry *ce, zend_string
*name
}
}
- if (Z_ISUNDEF_P(property) && (!optional_type || allow_null)) {
- ZVAL_NULL(property);
- }
-
if (!(access_type & ZEND_ACC_PPP_MASK)) {
access_type |= ZEND_ACC_PUBLIC;
}
diff --git a/Zend/zend_compile.c b/Zend/zend_compile..c
index 3505b18..b730d77 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5615,6 +5615,8 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast) /* {{{ */
zend_get_type_by_const(optional_type));
}
}
+ } else if (!optional_type || allow_null) {
+ ZVAL_NULL(&value_zv);
} else {
ZVAL_UNDEF(&value_zv);
}