File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-20905: Lazy proxy bailing __clone assertion
3+ --FILE--
4+ <?php
5+
6+ function test () {
7+ function f () {}
8+ }
9+
10+ class A {
11+ public $ _ ;
12+ public function __clone () {
13+ test ();
14+ }
15+ }
16+
17+ test ();
18+ clone (new ReflectionClass (A::class))->newLazyProxy (fn () => new A );
19+
20+ ?>
21+ --EXPECTF--
22+ Fatal error: Cannot redeclare function f() (previously declared in %s:%d) in %s on line %d
Original file line number Diff line number Diff line change @@ -744,12 +744,11 @@ zend_object *zend_lazy_object_clone(zend_object *old_obj)
744744 }
745745 }
746746
747- OBJ_EXTRA_FLAGS (new_proxy ) = OBJ_EXTRA_FLAGS (old_obj );
748-
749747 zend_lazy_object_info * new_info = emalloc (sizeof (* info ));
750748 * new_info = * info ;
751749 new_info -> u .instance = zend_objects_clone_obj (info -> u .instance );
752750
751+ OBJ_EXTRA_FLAGS (new_proxy ) = OBJ_EXTRA_FLAGS (old_obj );
753752 zend_lazy_object_set_info (new_proxy , new_info );
754753
755754 return new_proxy ;
You can’t perform that action at this time.
0 commit comments