com php-src: Removed useles code (default value should be already properly set in trait property): Zend/tests/type_declarations/typed_
properties_059.phpt Zend/zend_inheritance.c

From: Date: Fri, 27 May 2016 09:32:33 +0000
Subject: com php-src: Removed useles code (default value should be already properly set in trait property): Zend/tests/type_declarations/typed_
properties_059.phpt Zend/zend_inheritance.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95501@lists.php.net to get a copy of this message
Commit: 6bb1fa9b94fdcd563ed1d11af079051ea3a61023 Author: Dmitry Stogov <dmitry@zend.com> Fri, 27 May 2016 12:32:33 +0300 Parents: c5e45ff0eb73e908f87734c85299b771f1243842 Branches: typed_ref_properties Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6bb1fa9b94fdcd563ed1d11af079051ea3a61023 Log: Removed useles code (default value should be already properly set in trait property) Changed paths: A Zend/tests/type_declarations/typed_properties_059.phpt M Zend/zend_inheritance.c Diff: diff --git a/Zend/tests/type_declarations/typed_properties_059.phpt b/Zend/tests/type_declarations/typed_properties_059.phpt new file mode 100644 index 0000000..e0c6d4d --- /dev/null +++ b/Zend/tests/type_declarations/typed_properties_059.phpt @@ -0,0 +1,29 @@ +--TEST-- +Nullable typed properties in traits +--FILE-- +<?php +trait T { + public int $a1; + public ?int $b1; +} + +class A { + use T; + public int $a2; + public ?int $b2; +} + +$x = new A; +var_dump($x); +?> +--EXPECT-- +object(A)#1 (2) { + ["a2"]=> + uninitialized(integer) + ["b2"]=> + NULL + ["a1"]=> + uninitialized(integer) + ["b1"]=> + NULL +} diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 5ebf38b..da23431 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -1678,9 +1678,6 @@ static void zend_do_traits_property_binding(zend_class_entry *ce) /* {{{ */ doc_comment = property_info->doc_comment ? zend_string_copy(property_info->doc_comment) : NULL; if (property_info->type) { - if (Z_TYPE_P(prop_value) == IS_NULL) { - ZVAL_UNDEF(prop_value); - } zend_declare_typed_property(ce, prop_name, prop_value, flags, doc_comment, property_info->type, property_info->type_name, property_info->allow_null); } else { zend_declare_property_ex(ce, prop_name, prop_value, flags, doc_comment);

« previous php.cvs (#95501) next »