-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to extend UrlScript #187
Comments
Update: Suggested solution doesn't works :-/ |
This code is works very well but ugly: public function withPath(string $path, string $scriptPath = '')
{
$dolly = clone $this;
$dolly->scriptPath = $scriptPath;
return call_user_func([$dolly, '\Nette\Http\UrlImmutable::withPath'], $path);
} |
jakubboucek
added a commit
to jakubboucek/http
that referenced
this issue
Nov 14, 2020
jakubboucek
added a commit
to jakubboucek/http
that referenced
this issue
Nov 14, 2020
dg
pushed a commit
that referenced
this issue
Nov 16, 2020
dg
pushed a commit
that referenced
this issue
Dec 17, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version: 3.0.5
PHP: 7.3.24
Bug Description
UrlScript
is not work correctly when is extended. The methodwithPath()
is calling themself recursive in infinite loop and crash with error:The reason is the callback
parent::withPath
incall_user_func()
function is always called in top of descendants hierarchy context.That's mean:
Steps To Reproduce
Expected Behavior
Don't crash ;-)
Possible Solution
Only reason why is
UrlScript
usingcall_user_func()
function to call parent method through is calling in cloned object context.UrlScript
is inherits fromUrlImmuitable
,UrlImmuitable::withPath()
is always create clone too. When callsUrlScript::withPath()
it's clone class twice.Possible Solution is stop cloning object inUrlScript
scope and rely it toUrlImmuitable
.I suggest to change methodwithPath()
like:Is it my considerations right?No, isn't, see comment below.The text was updated successfully, but these errors were encountered: