CodeIgniter Forums
Puzzling Error - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Support (
+--- Thread: Puzzling Error (/showthread.php?tid=82634)

Puzzling Error - donpwinston - 08-02-2022

I've upgraded CodeIgniter from 3.9 to 4.2.1. I'm getting the following exception for all my routes except two. I don't understand why. I don't know what is different about the two that work. Invalid routes are not giving me same error and not Page Not Found page. I was using the legacy routing in the previous version.


preg_match(): Compilation failed: unmatched closing parenthesis at offset 23
SYSTEMPATH/Router/Router.php at line 418

My route config:
PHP Code:
// The Auto Routing (Legacy) is very dangerous. It is easy to create vulnerable apps
// where controller filters or CSRF protection are bypassed.
// If you don't want to define all routes, please use the Auto Routing (Improved).
// Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.

 * --------------------------------------------------------------------
 * Route Definitions
 * --------------------------------------------------------------------

// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->get('/''ReadPdf::index'); //does not work
$routes->get('/enroll''Enroll::index'); //works!
$routes->get('/notice''Notice::index'); //works!
$routes->get('/notice/upload''Notice::upload'); //?
$routes->get('/notice/download/{:segment)/(:segment)''Notice::download/$1/$2'); //?
$routes->get('/receive-pdf''ReceivePdf::index'); //all of these below don't work

RE: Puzzling Error - iRedds - 08-02-2022

$routes->get('/notice/download/{:segment)/(:segment)', 'Notice::download/$1/$2'); //?

RE: Puzzling Error - donpwinston - 08-02-2022

(08-02-2022, 03:31 PM)iRedds Wrote: $routes->get('/notice/download/{Confusedegment)/(Confusedegment)', 'Notice::download/$1/$2'); //?

Duh. Thanks.