Welcome Guest, Not a member yet? Register   Sign In
Puzzling Error
#1

(This post was last modified: 08-02-2022, 08:52 AM by donpwinston.)

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.

ErrorException

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

My route config:
PHP Code:
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('ReadPdf');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
// 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.
//$routes->setAutoRoute(false);

/*
 * --------------------------------------------------------------------
 * 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
$routes->get('/read-pdf''ReadPdf::index');
$routes->get('/relay-pdf''RelayPdf::index');
$routes->get('/reset-pdf''ResetPdf::index');
$routes->get('/reset-pdf/list''ResetPdf::list');
$routes->get('/reset-pdf/move''ResetPdf::move');
$routes->get('/server-up''ServerUp::index');
$routes->get('/test''Test::index'); 
Simpler is always better
Reply
#2

(This post was last modified: 08-02-2022, 03:32 PM by iRedds.)

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

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

Duh. Thanks.
Simpler is always better
Reply




Theme © iAndrew 2016 - Forum software by © MyBB