bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.61k forks source link

Route Clipping RegEx #5719

Closed refringe closed 5 years ago

refringe commented 5 years ago

I have a route:

$route['cms/file/crop/(holding|image)/(thumb|full)/([a-zA-Z0-9]{32})'] = function ($library, $crop_type, $name_hash) {
    return 'cms/file/crop_'.$library.'/'.$crop_type.'/'.$name_hash;
};

Which causes the following error:

Severity: Warning --> preg_match(): Compilation failed: missing ) at offset 61 /srv/www/site.ca/private/codeigniter3/system/core/Router.php 399

After putting a debug output on line 399:

log_message('debug', "Router RegEx: #^'.$key.'$#'");

It writes the following to the debug log:

Router RegEx: #^'.cms/file/crop/(holding|image)/(thumb|full)/([a-zA-Z0-9]{32}.'$#'

Note the missing ) on the right.

Currently using (:any) as a workaround, but the former should work fine as well, no?

narfbg commented 5 years ago

Can't reproduce.