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

Incompatible with AltoRouter v2.0.3 #46

Open
BunyaminUsMedia opened this issue Jan 8, 2025 · 2 comments
Open

Incompatible with AltoRouter v2.0.3 #46

BunyaminUsMedia opened this issue Jan 8, 2025 · 2 comments

Comments

@BunyaminUsMedia
Copy link

Hi,

When updating PHP composer plugins, it automatically updates AltoRouter to v2.0.3. This version of AltoRouter is incompatible with Upstatement Routes v0.9.1.

I get the following error:

Uncaught TypeError: AltoRouter::map(): Argument #4 ($name) must be of type ?string, array given, called in /var/www/site/vendor/upstatement/routes/Routes.php on line 71 and defined in /var/www/site/vendor/altorouter/altorouter/AltoRouter.php:120

with the following example code:

Routes::map('users/[i:id]', function () { ... });

The origin of the problem is this:

// Routes.php line 71 & 72
$upstatement_routes->router->map('GET|POST|PUT|DELETE', $route, $callback, $args);
$upstatement_routes->router->map('GET|POST|PUT|DELETE', $route, $callback, $args);

It expects a string $name at the place of the $args but the array $args is given.

@martijnelzinga
Copy link

+1; $args argument seems to be unused?

// Routes.php line 71 & 72
$upstatement_routes->router->map('GET|POST|PUT|DELETE', trailingslashit($route), $callback );
$upstatement_routes->router->map('GET|POST|PUT|DELETE', untrailingslashit($route), $callback); 

@jmslbam
Copy link

jmslbam commented Jan 14, 2025

+1 This is one of the reasons to include the composer.lock in the repo to always have "the same code" / state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants