com php-src: add tests for inheritance of private props: Zend/tests/type_declarations/typed_properties_024 .phpt Zend/zend_inheritance.c
Zend/zend_vm_def. h
| From: | Bob Weinand | Date: | Wed, 09 Mar 2016 17:18:19 +0000 |
| Subject: | com php-src: add tests for inheritance of private props: Zend/tests/type_declarations/typed_properties_024 .phpt Zend/zend_inheritance.c Zend/zend_vm_def. h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95692@lists.php.net to get a copy of this message | ||
Commit: d195bce89e1171c01efbf2c1328d581694b9ebcc
Author: Joe Watkins <krakjoe@php.net> Wed, 9 Mar 2016 17:18:19 +0000
Parents: 5817fa33b38cd6ba009ed5a72a0be8f2f8504399
Branches: typed_ref_properties
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d195bce89e1171c01efbf2c1328d581694b9ebcc
Log:
add tests for inheritance of private props
Changed paths:
A Zend/tests/type_declarations/typed_properties_024.phpt
M Zend/zend_inheritance.c
M Zend/zend_vm_def.h
Diff:
diff --git a/Zend/tests/type_declarations/typed_properties_024.phpt
b/Zend/tests/type_declarations/typed_properties_024.phpt
new file mode 100644
index 0000000..d38fe24
--- /dev/null
+++ b/Zend/tests/type_declarations/typed_properties_024.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test typed properties ignore private props during inheritance
+--FILE--
+<?php
+class Foo {
+ private int $thing;
+}
+
+class Bar extends Foo {}
+
+echo "ok";
+?>
+--EXPECT--
+ok
+
+
+
+
+
+
+
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index ea66986..c5d1eeb 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -699,7 +699,7 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke
}
}
} else {
- if (UNEXPECTED(parent_info->type)) {
+ if (UNEXPECTED(parent_info->type && !(parent_info->flags & ZEND_ACC_PRIVATE)))
{
if (parent_info->type == IS_OBJECT) {
zend_error_noreturn(E_COMPILE_ERROR,
"Type of %s::$%s must be %s (as in class %s)",
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 4503a65..5e86b16 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -2570,6 +2570,9 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
#else
if (UNEXPECTED(EG(exception) != NULL) && (call_info & ZEND_CALL_CTOR)) {
#endif
+ if (Z_OBJCE_P(object)->ce_flags & ZEND_ACC_HAS_TYPE_HINTS) {
+
+ }
GC_REFCOUNT(object)--;
if (GC_REFCOUNT(object) == 1) {
zend_object_store_ctor_failed(object);