mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix lazy proxy bailing __clone assertion
This commit is contained in:
1
NEWS
1
NEWS
@@ -20,6 +20,7 @@ PHP NEWS
|
||||
backing value). (ilutov)
|
||||
. Fix OSS-Fuzz #438780145 (Nested finally with repeated return type check may
|
||||
uaf). (ilutov)
|
||||
. Fixed bug GH-20905 (Lazy proxy bailing __clone assertion). (ilutov)
|
||||
|
||||
- Date:
|
||||
. Update timelib to 2022.16. (Derick)
|
||||
|
||||
22
Zend/tests/lazy_objects/gh20905.phpt
Normal file
22
Zend/tests/lazy_objects/gh20905.phpt
Normal file
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
GH-20905: Lazy proxy bailing __clone assertion
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test() {
|
||||
function f() {}
|
||||
}
|
||||
|
||||
class A {
|
||||
public $_;
|
||||
public function __clone() {
|
||||
test();
|
||||
}
|
||||
}
|
||||
|
||||
test();
|
||||
clone (new ReflectionClass(A::class))->newLazyProxy(fn() => new A);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot redeclare function f() (previously declared in %s:%d) in %s on line %d
|
||||
@@ -744,12 +744,11 @@ zend_object *zend_lazy_object_clone(zend_object *old_obj)
|
||||
}
|
||||
}
|
||||
|
||||
OBJ_EXTRA_FLAGS(new_proxy) = OBJ_EXTRA_FLAGS(old_obj);
|
||||
|
||||
zend_lazy_object_info *new_info = emalloc(sizeof(*info));
|
||||
*new_info = *info;
|
||||
new_info->u.instance = zend_objects_clone_obj(info->u.instance);
|
||||
|
||||
OBJ_EXTRA_FLAGS(new_proxy) = OBJ_EXTRA_FLAGS(old_obj);
|
||||
zend_lazy_object_set_info(new_proxy, new_info);
|
||||
|
||||
return new_proxy;
|
||||
|
||||
Reference in New Issue
Block a user