com php-src: fix #71414 (Interface method override inherited method and implemented in a trait causes fatal error): Zend/tests/bug62358.phpt
Zend/tests/bug69467.phpt Zend/tests/traits/bug60153.phpt Zend/zend_compile.c

From: Date: Sat, 26 Mar 2016 23:47:31 +0000
Subject: com php-src: fix #71414 (Interface method override inherited method and implemented in a trait causes fatal error): Zend/tests/bug62358.phpt
Zend/tests/bug69467.phpt Zend/tests/traits/bug60153.phpt Zend/zend_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-91492@lists.php.net to get a copy of this message
Commit: 4327370d1308eab3c611fc6994e67048a18f92ef Author: Joe Watkins <krakjoe@php.net> Sat, 26 Mar 2016 23:47:31 +0000 Parents: 1a75cd29a200989aeed04f695df5b2b563cfd54e Branches: PHP-7.0 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4327370d1308eab3c611fc6994e67048a18f92ef Log: fix #71414 (Interface method override inherited method and implemented in a trait causes fatal error) Bugs: https://bugs.php.net/71414 Changed paths: M Zend/tests/bug62358.phpt M Zend/tests/bug69467.phpt M Zend/tests/traits/bug60153.phpt M Zend/zend_compile.c Diff: diff --git a/Zend/tests/bug62358.phpt b/Zend/tests/bug62358.phpt index 44480fc5..35bbc33 100644 --- a/Zend/tests/bug62358.phpt +++ b/Zend/tests/bug62358.phpt @@ -23,4 +23,4 @@ class B extends A { } ?> --EXPECTF-- -Warning: Declaration of B::foo($var) should be compatible with A::foo() in %sbug62358.php on line %d +Fatal error: Declaration of B::foo($var) must be compatible with I::foo() in %sbug62358.php on line 17 diff --git a/Zend/tests/bug69467.phpt b/Zend/tests/bug69467.phpt index 2228300..11ff72d 100644 --- a/Zend/tests/bug69467.phpt +++ b/Zend/tests/bug69467.phpt @@ -18,4 +18,4 @@ $test = new Foo(); var_dump($test instanceof Baz); ?> --EXPECTF-- -Fatal error: Access level to Bar::bad() must be public (as in class Baz) in %sbug69467.php on line %d +Fatal error: Access level to Foo::bad() must be public (as in class Baz) in %sbug69467.php on line %d diff --git a/Zend/tests/traits/bug60153.phpt b/Zend/tests/traits/bug60153.phpt index 979eced..8f01e72 100644 --- a/Zend/tests/traits/bug60153.phpt +++ b/Zend/tests/traits/bug60153.phpt @@ -16,4 +16,4 @@ class C implements IFoo { } --EXPECTF-- -Fatal error: Declaration of TFoo::oneArgument() must be compatible with IFoo::oneArgument($a) in %s on line %d +Fatal error: Declaration of C::oneArgument() must be compatible with IFoo::oneArgument($a) in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 24fffc9..bc33e07 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5311,10 +5311,6 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */ CG(active_class_entry) = ce; - if (implements_ast) { - zend_compile_implements(&declare_node, implements_ast); - } - zend_compile_stmt(stmt_ast); /* Reset lineno for final opcodes and errors */ @@ -5371,11 +5367,15 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */ zend_emit_op(NULL, ZEND_BIND_TRAITS, &declare_node, NULL); } + if (implements_ast) { + zend_compile_implements(&declare_node, implements_ast); + } + if (!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) - && (extends_ast || ce->num_interfaces > 0) + && (extends_ast || implements_ast) ) { zend_verify_abstract_class(ce); - if (ce->num_interfaces && !(ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS)) { + if (implements_ast) { zend_emit_op(NULL, ZEND_VERIFY_ABSTRACT_CLASS, &declare_node, NULL); } }

« previous php.cvs (#91492) next »