diff --git a/src/gen_stub.php b/src/gen_stub.php index 0ba7faf2..bcf590e9 100755 --- a/src/gen_stub.php +++ b/src/gen_stub.php @@ -5555,7 +5555,7 @@ function generateFunctionAttributeInitialization(iterable $funcInfos, array $all "func_" . $funcInfo->name->getNameForAttributes() . "_$key", $allConstInfos, $phpVersionIdMinimumCompatibility, - $useDeclared + refval($useDeclared) ); } @@ -5566,7 +5566,7 @@ function generateFunctionAttributeInitialization(iterable $funcInfos, array $all "func_{$funcInfo->name->getNameForAttributes()}_arg{$index}_$key", $allConstInfos, $phpVersionIdMinimumCompatibility, - $useDeclared + refval($useDeclared) ); } } @@ -5627,7 +5627,7 @@ function generateGlobalConstantAttributeInitialization( $constVarName . "_$key", $allConstInfos, PHP_85_VERSION_ID, - $useDeclared + refval($useDeclared) ); } @@ -5675,7 +5675,7 @@ function generateConstantAttributeInitialization( "const_" . $constInfo->name->getDeclarationName() . "_$key", $allConstInfos, $phpVersionIdMinimumCompatibility, - $useDeclared + refval($useDeclared) ); } @@ -5705,7 +5705,7 @@ function generatePropertyAttributeInitialization( "property_" . $propertyInfo->name->getDeclarationName() . "_" . $key, $allConstInfos, $phpVersionIdMinimumCompatibility, - $declaredStrings + refval($declaredStrings) ); } } diff --git a/tests/aot/closure/closure-use-reference-callback.phpt b/tests/aot/closure/closure-use-reference-callback.phpt new file mode 100644 index 00000000..56f5f54f --- /dev/null +++ b/tests/aot/closure/closure-use-reference-callback.phpt @@ -0,0 +1,74 @@ +--TEST-- +Closure use reference capture through callbacks +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + string(6) "even:2" + [1]=> + string(6) "even:4" +} +string(9) "[1][2][3]" +array(3) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) +} +string(3) "s_0" +string(3) "s_1" +string(3) "s_0" +array(2) { + ["alpha"]=> + string(3) "s_0" + ["beta"]=> + string(3) "s_1" +}