Skip to content
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

TypeError: rawurlencode(): Argument #1 ($string) must be of type string, int given in laminas-router\src\Http\Regex.php:158 #14

Closed
matbech opened this issue Nov 18, 2020 · 1 comment
Labels
Bug Something isn't working
Milestone

Comments

@matbech
Copy link
Contributor

matbech commented Nov 18, 2020

With the latest update I get the following type error now using PHP 8.0
TypeError: rawurlencode(): Argument #1 ($string) must be of type string, int given in laminas-router\src\Http\Regex.php:158

Stack trace:

0 laminas\laminas-router\src\Http\Regex.php(158): rawurlencode(53)
#1 laminas\laminas-router\src\Http\TreeRouteStack.php(373): Laminas\Router\Http\Regex->assemble(Array, Array)
#2 laminas\laminas-router\src\Http\Part.php(219): Laminas\Router\Http\TreeRouteStack->assemble(Array, Array)
#3 laminas\laminas-router\src\Http\TreeRouteStack.php(394): Laminas\Router\Http\Part->assemble(Array, Array)
#4 laminas\laminas-view\src\Helper\Url.php(105): Laminas\Router\Http\TreeRouteStack->assemble(Array, Array)
#5 [internal function]: Laminas\View\Helper\Url->__invoke('localeroute/kb....', Array)
#6 laminas\laminas-view\src\Renderer\PhpRenderer.php(396): call_user_func_array(Object(Laminas\View\Helper\Url), Array)

It looks like the problem is when the values passed to the view url helper $options aren't string types:
$options = ['id' => 3 ];
$this->view->url($route, $options);

Is this the correct/expected behavior, then this bug report can be closed.

@matbech matbech added the Bug Something isn't working label Nov 18, 2020
weierophinney added a commit to weierophinney/laminas-router that referenced this issue Nov 19, 2020
The `Regex` router, when assembling a URL, was not casting values to string when calling `rawurlencode()`, leading to a `TypeError` in PHP 8.

[optional footerFixes laminas#14

Signed-off-by: Matthew Weier O'Phinney <[email protected]>
@weierophinney weierophinney added this to the 3.4.1 milestone Nov 19, 2020
weierophinney added a commit that referenced this issue Nov 19, 2020
The `Regex` router, when assembling a URL, was not casting values to string when calling `rawurlencode()`, leading to a `TypeError` in PHP 8.

[optional footerFixes #14

Signed-off-by: Matthew Weier O'Phinney <[email protected]>
@weierophinney
Copy link
Member

Fixed with #15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants