com php-src: fix inheritance error: Zend/zend_inheritance.c

From: Date: Tue, 07 Jun 2016 07:01:23 +0000
Subject: com php-src: fix inheritance error: Zend/zend_inheritance.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95493@lists.php.net to get a copy of this message
Commit: 8eec27f9db01817677321f0fbd1aed6971fb386c Author: Joe Watkins <krakjoe@php.net> Tue, 7 Jun 2016 08:01:23 +0100 Parents: 71cda1bf485a9ad2e0b50a6720c3d3bb9956a7ee Branches: typed_ref_properties Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8eec27f9db01817677321f0fbd1aed6971fb386c Log: fix inheritance error Changed paths: M Zend/zend_inheritance.c Diff: diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 0b82707..09ef7ed 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -707,38 +707,36 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke } } - if (!(child_info->flags & ZEND_ACC_CHANGED)) { - if (UNEXPECTED(parent_info->type && !(parent_info->flags & ZEND_ACC_PRIVATE))) { - if (parent_info->type == IS_OBJECT) { - if (child_info->type != IS_OBJECT || - child_info->allow_null != parent_info->allow_null || - !zend_string_equals_ci(zend_resolve_property_type(parent_info->type_name, parent_info->ce), - zend_resolve_property_type(child_info->type_name, child_info->ce))) { - zend_error_noreturn(E_COMPILE_ERROR, - "Type of %s::$%s must be %s%s (as in class %s)", - ZSTR_VAL(ce->name), - ZSTR_VAL(key), - parent_info->allow_null ? "?" : "", - ZSTR_VAL(zend_resolve_property_type(parent_info->type_name, parent_info->ce)), - ZSTR_VAL(ce->parent->name)); - } - } else if (parent_info->type != child_info->type || - parent_info->allow_null != child_info->allow_null) { + if (UNEXPECTED(parent_info->type && !(parent_info->flags & ZEND_ACC_PRIVATE))) { + if (parent_info->type == IS_OBJECT) { + if (child_info->type != IS_OBJECT || + child_info->allow_null != parent_info->allow_null || + !zend_string_equals_ci(zend_resolve_property_type(parent_info->type_name, parent_info->ce), + zend_resolve_property_type(child_info->type_name, child_info->ce))) { zend_error_noreturn(E_COMPILE_ERROR, - "Type of %s::$%s must be %s%s (as in class %s)", + "Type of %s::$%s must be %s%s (as in class %s)", ZSTR_VAL(ce->name), ZSTR_VAL(key), parent_info->allow_null ? "?" : "", - zend_get_type_by_const(parent_info->type), + ZSTR_VAL(zend_resolve_property_type(parent_info->type_name, parent_info->ce)), ZSTR_VAL(ce->parent->name)); } - } else if (UNEXPECTED(child_info->type && !parent_info->type)) { + } else if (parent_info->type != child_info->type || + parent_info->allow_null != child_info->allow_null) { zend_error_noreturn(E_COMPILE_ERROR, - "Type of %s::$%s must not be defined (as in class %s)", - ZSTR_VAL(ce->name), - ZSTR_VAL(key), - ZSTR_VAL(ce->parent->name)); + "Type of %s::$%s must be %s%s (as in class %s)", + ZSTR_VAL(ce->name), + ZSTR_VAL(key), + parent_info->allow_null ? "?" : "", + zend_get_type_by_const(parent_info->type), + ZSTR_VAL(ce->parent->name)); } + } else if (UNEXPECTED(child_info->type && !parent_info->type)) { + zend_error_noreturn(E_COMPILE_ERROR, + "Type of %s::$%s must not be defined (as in class %s)", + ZSTR_VAL(ce->name), + ZSTR_VAL(key), + ZSTR_VAL(ce->parent->name)); } } else { if (UNEXPECTED(parent_info->flags & (ZEND_ACC_PRIVATE|ZEND_ACC_SHADOW))) {

« previous php.cvs (#95493) next »