Welcome Guest, Not a member yet? Register   Sign In
$routes->match() behavior in 4.4.1
(This post was last modified: 09-13-2023, 02:43 AM by joho.)

Does $routes->match() behave differently in 4.4.x?

I have this, and it works for 4.3.x, but seemingly not for 4.4.1:

use CodeIgniter\Router\RouteCollection;
use App\Controllers\zAdmin;


$routes->get( '/', [zAdmin::class, 'index'] );

$routes->group( 'zadmin', static function( $routes ) {
    $routes->match( ['get','post'], 'fetchinfo', [zAdmin::class, 'ajax_fetch'] );
    $routes->match( ['get','post'], 'fetchrepoinfo', [zAdmin::class, 'ajax_fetch_repo'] );
    $routes->match( ['get','post'], 'fetchzampnews', [zAdmin::class, 'ajax_fetch_zamp_news'] );
    $routes->match( ['get','post'], 'tagzampnews', [zAdmin::class, 'ajax_tag_zamp_news'] );
    $routes->match( ['get'], 'zamprepo', [zAdmin::class, 'zamprepo'] );
    $routes->match( ['get'], 'zampnews', [zAdmin::class, 'zampnews'] );
    $routes->match( ['get', 'post'], 'create', [zAdmin::class, 'edit'] );
    $routes->match( ['get', 'post'], 'edit/(:segment)', [zAdmin::class, 'edit'] );
    $routes->match( ['get'], '(:segment)', [zAdmin::class, 'view'] );
    $routes->get( '/', [zAdmin::class, 'index'] );

"Home" work, i.e. no parameters at all, but anything other than that yields a 404 with messages like "Can't find a route for 'get: 2'" (which I think should have been triggered on the second to last match(). I'm obviously doing something wrong, I just don't know what?

Hmm ... apparently this:

$routes->group( 'zadmin', static function( $routes )

needed to be this:

$routes->group( '', static function( $routes )


Messages In This Thread
$routes->match() behavior in 4.4.1 - by joho - 09-13-2023, 02:31 AM
RE: $routes->match() behavior in 4.4.1 - by joho - 09-13-2023, 06:39 AM

Theme © iAndrew 2016 - Forum software by © MyBB