diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 2c94a6e80d18..c0a8b11e0cf7 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -5415,6 +5415,7 @@ void reflection_class_new_lazy(INTERNAL_FUNCTION_PARAMETERS, strategy | options); if (!obj) { + zend_release_fcall_info_cache(&fcc); RETURN_THROWS(); } diff --git a/ext/reflection/tests/ReflectionClass_makeLazyGhost_no_trampoline_leak.phpt b/ext/reflection/tests/ReflectionClass_makeLazyGhost_no_trampoline_leak.phpt new file mode 100644 index 000000000000..dee9b56e5cdd --- /dev/null +++ b/ext/reflection/tests/ReflectionClass_makeLazyGhost_no_trampoline_leak.phpt @@ -0,0 +1,16 @@ +--TEST-- +ReflectionClass::makeLazyGhost() no trampoline leak +--FILE-- +newLazyGhost([new Helper, 'foo']); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +Cannot make instance of internal class lazy: ReflectionClass is internal