?? ??? 2016 PHP 7.0.10
- Core:
+ . Fixed bug #72594 (Calling an earlier instance of an included anonymous
+ class fatals). (Laruence)
. Fixed bug #72581 (previous property undefined in Exception after
deserialization). (Laruence)
. Fixed bug #72496 (Cannot declare public method with signature incompatible
--- /dev/null
+--TEST--
+Bug #72594 (Calling an earlier instance of an included anonymous class fatals)
+--INI--
+opcache.enable=0
+--FILE--
+<?php
+if (isset($runtime)) {
+ return new class {
+ public $bar;
+ public function bing($foo = null) {
+ if ($foo) $foo->bing();
+ }
+ };
+}
+
+$runtime = 1;
+$oldFoo = require(__FILE__);
+$newFoo = require(__FILE__);
+
+var_dump(get_class_methods($oldFoo));
+var_dump(get_object_vars($oldFoo));
+
+$newFoo->bing($oldFoo);
+?>
+--EXPECTF--
+array(1) {
+ [0]=>
+ string(4) "bing"
+}
+array(1) {
+ ["bar"]=>
+ NULL
+}
opline = get_next_op(CG(active_op_array));
zend_make_var_result(&declare_node, opline);
- // TODO.AST drop this
+ /* TODO.AST drop this */
GET_NODE(&FC(implementing_class), opline->result);
opline->op2_type = IS_CONST;
opline->op1_type = IS_UNUSED;
- zend_hash_update_ptr(CG(class_table), lcname, ce);
+ if (!zend_hash_exists(CG(class_table), lcname)) {
+ zend_hash_add_ptr(CG(class_table), lcname, ce);
+ } else {
+ /* this anonymous class has been included */
+ zval zv;
+ ZVAL_PTR(&zv, ce);
+ destroy_zend_class(&zv);
+ return;
+ }
} else {
zend_string *key;
}
/* }}} */
-
void zend_compile_const_decl(zend_ast *ast) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);