Closed tolgadevsec closed 7 months ago
Same problem with a laminas project here.
It probably worked before this PR got merged: https://github.com/laminas/laminas-code/pull/72/files which was merged into 4.2.0
.
Can we find a fix for this, please? Maybe @tolgadevsec can make a PR for his changes so they can be evaluated against the tests.
Hey, @mchekin, stop breaking the laminas-code
API ) Your change has introduced a BC break in minor version and affected my framework.
@lisachenko the issue in upstream lib is fixed so this issue is also resolved in laminas/laminas-code v4.9.0
Hi! I'm using the Go! AOP framework (
"^3.0"
) in my Laravel project ("^8.40"
), however, I'm running into the following exception thrown from the LaminasParameterGenerator
class when the following line is called:https://github.com/laminas/laminas-code/blob/17fd2af36804f3f61788573cb70196454d6ee1d8/src/Generator/ParameterGenerator.php#L260
https://github.com/goaop/framework/blob/501d013c78e92057601c17ca0df1a59ab984f210/src/Proxy/Part/FunctionParameterList.php#L66
It seems that the
$defaultValue
passed to the constructor of theParameterGenerator
in line 62 really needs to benull
for optional and non-variadic parameters. This is not the case due to: https://github.com/goaop/framework/blob/501d013c78e92057601c17ca0df1a59ab984f210/src/Proxy/Part/FunctionParameterList.php#L46I also have one case where I have a controller method with a default parameter value, this is a non-variadic parameter as well and runs into the same Exception. However, I was able to resolve both issues by explicitly setting the default value after the
setVariadic
call instead of doing it before. This has the reason thatsetVariadic
is checking whether its default value attribute is set (and throws an Exception if thats the case) before it actually sets the variadic attribute to true or false.Here is a snippet of what I have changed:
Hope this can be of use to anyone running into the same issue. Let me know if further information are required for reproduction - the Laravel project that I'm working on is pretty much an empty project with one HTTP controller.
Kind regards, Tolga