Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -6370,7 +6370,7 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */
"Cannot use '%s' as class name as it is reserved", ZSTR_VAL(extends_name));
}

zend_compile_class_ref(&extends_node, extends_ast, 0);
zend_compile_class_ref(&extends_node, extends_ast, 1);
ce->ce_flags |= ZEND_ACC_INHERITED;
}

Expand Down
13 changes: 12 additions & 1 deletion ext/spl/tests/bug73423.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,15 @@ foreach (new \RecursiveIteratorIterator (new fooIterator ($foo)) as $bar) ;

?>
--EXPECTF--
Fatal error: Class 'NotExists' not found in %sbug73423.php(%d) : eval()'d code on line 1
Fatal error: Uncaught Error: Class 'NotExists' not found in %sbug73423.php(%d) : eval()'d code:1
Stack trace:
#0 %sbug73423.php(%d): eval()
#1 %sbug73423.php(%d): fooIterator->__destruct()
#2 {main}

Next Error: Class 'NotExists' not found in %sbug73423.php(%d) : eval()'d code:1
Stack trace:
#0 %sbug73423.php(%d): eval()
#1 %sbug73423.php(%d): fooIterator->__destruct()
#2 {main}
thrown in %sbug73423.php(%d) : eval()'d code on line 1
5 changes: 4 additions & 1 deletion tests/classes/autoload_011.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ class C extends UndefBase
--EXPECTF--
In autoload: string(9) "UndefBase"

Fatal error: Class 'UndefBase' not found in %s on line %d
Fatal error: Uncaught Error: Class 'UndefBase' not found in %s:%d
Stack trace:
#0 {main}
thrown in %sautoload_011.php on line %d
22 changes: 22 additions & 0 deletions tests/classes/bug75765.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Ensure that extending of undefined class throws the exception
--FILE--
<?php

try {
class A extends B {}
} catch (Error $e) {
var_dump(class_exists('A'));
var_dump(class_exists('B'));
throw $e;
}

?>
--EXPECTF--
bool(false)
bool(false)

Fatal error: Uncaught Error: Class 'B' not found in %sbug75765.php:%d
Stack trace:
#0 {main}
thrown in %sbug75765.php on line %d