You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
UrlScript is not work correctly when is extended. The method withPath() is calling themself recursive in infinite loop and crash with error:
Maximum function nesting level of '256' reached, aborting!
The reason is the callback parent::withPath in call_user_func() function is always called in top of descendants hierarchy context.
That's mean:
class CustomUrl extends UrlScript parent::withPath() call_user_func('parent::withPath')
| |
+--------------------------------+------------------------------------+
| +-------------------------------------------------------------------------------------+
v v |
class UrlScript extends UrlImmutable parent::withPath() call_user_func('parent::withPath') |
| | |
+-----------------------------+ +------------------+
|
v
class UrlImmutable
Only reason why is UrlScript using call_user_func() function to call parent method through is calling in cloned object context.
UrlScript is inherits from UrlImmuitable, UrlImmuitable::withPath() is always create clone too. When calls UrlScript::withPath() it's clone class twice.
Possible Solution is stop cloning object in UrlScript scope and rely it to UrlImmuitable.
Activity
jakubboucek commentedon Nov 14, 2020
Update: Suggested solution doesn't works :-/
jakubboucek commentedon Nov 14, 2020
This code is works very well but ugly:
ScriptUrl: Fix class extendability (nette#187)
ScriptUrl: Fix class extendability (nette#187)
ScriptUrl: Fix class extendability (#187) (#188)
ScriptUrl: Fix class extendability (#187) (#188)