Skip to content

Commit f2bb41a

Browse files
committed
Reflection: Fix trampoline leak when object construction fails for lazy object
1 parent ffe75c9 commit f2bb41a

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎ext/reflection/php_reflection.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5415,6 +5415,7 @@ void reflection_class_new_lazy(INTERNAL_FUNCTION_PARAMETERS,
54155415
strategy | options);
54165416

54175417
if (!obj) {
5418+
zend_release_fcall_info_cache(&fcc);
54185419
RETURN_THROWS();
54195420
}
54205421

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
ReflectionClass::makeLazyGhost() no trampoline leak
3+
--FILE--
4+
<?php
5+
class Helper {
6+
public function __call($name, $args) {}
7+
}
8+
9+
try {
10+
(new ReflectionClass('ReflectionClass'))->newLazyGhost([new Helper, 'foo']);
11+
} catch (Error $e) {
12+
echo $e->getMessage(), "\n";
13+
}
14+
?>
15+
--EXPECT--
16+
Cannot make instance of internal class lazy: ReflectionClass is internal

0 commit comments

Comments
 (0)