diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 32a6e8a6..b5be87cf 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -1023,6 +1023,9 @@ class CompilerBase extends \PhpAot\Core\Translator $argInfo->nullable = true; } if ($param->default) { + if ($param->byRef) { + $this->fatalError($param, 'Default value for parameters passed by reference is not supported'); + } $defaultValueCount++; $argInfo->default = $this->parseParamDefaultValue($param->default); $argInfo->defaultValue = $param->default; diff --git a/tests/aot/deep-recursion.phpt b/tests/aot/deep-recursion.phpt new file mode 100644 index 00000000..0605b763 --- /dev/null +++ b/tests/aot/deep-recursion.phpt @@ -0,0 +1,137 @@ +--TEST-- +Deep Recursion Test +--FILE-- + 1, + 'children' => [ + [ + 'value' => 2, + 'children' => [ + ['value' => 4, 'children' => []], + ['value' => 5, 'children' => []], + ], + ], + [ + 'value' => 3, + 'children' => [ + ['value' => 6, 'children' => []], + ], + ], + ], + ]; + + var_dump(sumTree($tree)); + + $unsorted = [3, 6, 1, 5, 2, 4]; + var_dump(quicksort($unsorted)); +} +?> +--EXPECT-- +int(120) +int(3628800) +int(89) +int(987) +bool(true) +bool(false) +bool(false) +bool(true) +int(21) +array(6) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) +}