File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ PHP NEWS
2020 backing value). (ilutov)
2121 . Fix OSS-Fuzz #438780145 (Nested finally with repeated return type check may
2222 uaf). (ilutov)
23+ . Fixed bug GH-20905 (Lazy proxy bailing __clone assertion). (ilutov)
2324
2425- Date:
2526 . Update timelib to 2022.16. (Derick)
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