Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Http/UrlScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public function withPath(string $path, string $scriptPath = '')
{
$dolly = clone $this;
$dolly->scriptPath = $scriptPath;
return call_user_func([$dolly, 'parent::withPath'], $path);
$parent = \Closure::fromCallable([UrlImmutable::class, 'withPath'])->bindTo($dolly);
return $parent($path);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closure::call() exists since PHP 7, so it should be possible to simplify this to

Closure::fromCallable([UrlImmutable::class, 'withPath'])->call($dolly, $path)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it first. It works only for anonymous functions.

Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()

More info: https://bugs.php.net/bug.php?id=74558

}


Expand Down