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

Bug: spark routes doesn't work with (.+) #8972

Closed
tangix opened this issue Jun 18, 2024 · 2 comments · Fixed by #8974
Closed

Bug: spark routes doesn't work with (.+) #8972

tangix opened this issue Jun 18, 2024 · 2 comments · Fixed by #8974
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@tangix
Copy link
Contributor

tangix commented Jun 18, 2024

PHP Version

8.1

CodeIgniter4 Version

4.5.2

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

macOS

Which server did you use?

apache

Database

No response

What happened?

Running php spark routes I get the following error:

$ php spark routes

CodeIgniter v4.5.2 Command Line Tool - Server Time: 2024-06-18 07:59:01 UTC+00:00

[CodeIgniter\HTTP\Exceptions\BadRequestException]
The URI you submitted has disallowed characters: "(. )"
at SYSTEMPATH/Router/Router.php:736

Backtrace:
  1    SYSTEMPATH/Router/Router.php:203
       CodeIgniter\Router\Router()->checkDisallowedChars('picker/(. )')

  2    SYSTEMPATH/Commands/Utilities/Routes/FilterFinder.php:40
       CodeIgniter\Router\Router()->handle('picker/(. )')

  3    SYSTEMPATH/Commands/Utilities/Routes/FilterFinder.php:56
       CodeIgniter\Commands\Utilities\Routes\FilterFinder()->getRouteFilters('picker/(.+)')

  4    SYSTEMPATH/Commands/Utilities/Routes/FilterCollector.php:79
       CodeIgniter\Commands\Utilities\Routes\FilterFinder()->find('picker/(.+)')

  5    SYSTEMPATH/Commands/Utilities/Routes.php:113
       CodeIgniter\Commands\Utilities\Routes\FilterCollector()->get('OPTIONS', 'picker/(.+)')

  6    SYSTEMPATH/CLI/Commands.php:70
       CodeIgniter\Commands\Utilities\Routes()->run([])

  7    SYSTEMPATH/CLI/Console.php:48
       CodeIgniter\CLI\Commands()->run('routes', [])

  8    SYSTEMPATH/Boot.php:351
       CodeIgniter\CLI\Console()->run()

  9    SYSTEMPATH/Boot.php:104
       CodeIgniter\Boot::runCommand(Object(CodeIgniter\CLI\Console))

 10    ROOTPATH/spark:84
       CodeIgniter\Boot::bootSpark(Object(Config\Paths))

Steps to Reproduce

Configure app/Config/Routes.php contains the following definitions, which should be allowed as I understand it - https://codeigniter.com/user_guide/incoming/routing.html#regular-expressions

$routes->options('picker/(.+)', 'Options::index');

app/Config/App.php contains:

public string $permittedURIChars = 'a-z 0-9~%.:_\-';

Expected Output

The route table displayed as exepected.

Anything else?

No response

@tangix tangix added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 18, 2024
@tangix
Copy link
Contributor Author

tangix commented Jun 18, 2024

Possible work-around, change the definition to be:

$routes->addPlaceholder('plus', '.+');
$routes->options('picker/(:plus)', 'Options::index');

@kenjis
Copy link
Member

kenjis commented Jun 19, 2024

Check #8974

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants