CodeIgniter v4.3.8 and v4.4.0 Released! |
(08-28-2023, 06:16 PM)kenjis Wrote: @chaos Did you customize Services for URI or Request?No, I am just calling anchor function (inside a Model if it can help)
i got this error after upgrading to 4.4.0
TypeError CodeIgniter\Router\RouteCollection::__construct(): Argument #3 ($routing) must be of type Config\Routing, null given, called in C:\xampp\htdocs\GPMS\vendor\codeigniter4\framework\system\Config\Services.php on line 617 SYSTEMPATH\Router\RouteCollection.php at line 283 276 * Flag to limit or not the routes with {locale} placeholder to App::$supportedLocales 277 */ 278 protected bool $useSupportedLocalesOnly = false; 279 280 /** 281 * Constructor 282 */ 283 public function __construct(FileLocator $locator, Modules $moduleConfig, Routing $routing) 284 { 285 $this->fileLocator = $locator; 286 $this->moduleConfig = $moduleConfig; 287 288 $this->httpHost = Services::request()->getServer('HTTP_HOST'); 289 290 // Setup based on config file. Let routes file override. Backtrace Server Request Response Files Memory SYSTEMPATH\Config\Services.php : 617 — CodeIgniter\Router\RouteCollection->__construct ( arguments ) 610 */ 611 public static function routes(bool $getShared = true) 612 { 613 if ($getShared) { 614 return static::getSharedInstance('routes'); 615 } 616 617 return new RouteCollection(AppServices::locator(), config(Modules::class), config(Routing::class)); 618 } 619 620 /** 621 * The Router class uses a RouteCollection's array of routes, and determines 622 * the correct Controller and Method to execute. 623 * 624 * @return Router SYSTEMPATH\Config\BaseService.php : 258 — CodeIgniter\Config\Services::routes ( arguments ) 251 { 252 $service = static: ![]() 253 254 if ($service === null) { 255 return null; 256 } 257 258 return $service::$name(...$arguments); 259 } 260 261 /** 262 * Check if the requested service is defined and return the declaring 263 * class. Return null if not found. 264 */ 265 public static function serviceExists(string $name): ?string SYSTEMPATH\Config\BaseService.php : 199 — CodeIgniter\Config\BaseService::__callStatic ( arguments ) 192 return static::$mocks[$key]; 193 } 194 195 if (! isset(static::$instances[$key])) { 196 // Make sure $getShared is false 197 $params[] = false; 198 199 static::$instances[$key] = AppServices::$key(...$params); 200 } 201 202 return static::$instances[$key]; 203 } 204 205 /** 206 * The Autoloader class is the central class that handles our SYSTEMPATH\Config\Services.php : 614 — CodeIgniter\Config\BaseService::getSharedInstance ( arguments ) 607 * a collection of routes. 608 * 609 * @return RouteCollection 610 */ 611 public static function routes(bool $getShared = true) 612 { 613 if ($getShared) { 614 return static::getSharedInstance('routes'); 615 } 616 617 return new RouteCollection(AppServices::locator(), config(Modules::class), config(Routing::class)); 618 } 619 620 /** 621 * The Router class uses a RouteCollection's array of routes, and determines SYSTEMPATH\Config\BaseService.php : 258 — CodeIgniter\Config\Services::routes () 251 { 252 $service = static: ![]() 253 254 if ($service === null) { 255 return null; 256 } 257 258 return $service::$name(...$arguments); 259 } 260 261 /** 262 * Check if the requested service is defined and return the declaring 263 * class. Return null if not found. 264 */ 265 public static function serviceExists(string $name): ?string SYSTEMPATH\CodeIgniter.php : 783 — CodeIgniter\Config\BaseService::__callStatic ( arguments ) 776 * @return string|string[]|null Route filters, that is, the filters specified in the routes file 777 * 778 * @throws RedirectException 779 */ 780 protected function tryToRouteIt(?RouteCollectionInterface $routes = null) 781 { 782 if ($routes === null) { 783 $routes = Services::routes()->loadRoutes(); 784 } 785 786 // $routes is defined in Config/Routes.php 787 $this->router = Services::router($routes, $this->request); 788 789 $path = $this->determinePath(); 790 SYSTEMPATH\CodeIgniter.php : 442 — CodeIgniter\CodeIgniter->tryToRouteIt ( arguments ) 435 436 // Check for a cached page. Execution will stop 437 // if the page has been cached. 438 if (($response = $this->displayCache($cacheConfig)) instanceof ResponseInterface) { 439 return $response; 440 } 441 442 $routeFilter = $this->tryToRouteIt($routes); 443 444 $uri = $this->determinePath(); 445 446 if ($this->enableFilters) { 447 // Start up the filters 448 $filters = Services::filters(); 449 SYSTEMPATH\CodeIgniter.php : 353 — CodeIgniter\CodeIgniter->handleRequest ( arguments ) 346 347 $this->getRequestObject(); 348 $this->getResponseObject(); 349 350 $this->spoofRequestMethod(); 351 352 try { 353 $this->response = $this->handleRequest($routes, config(Cache::class), $returnResponse); 354 } catch (ResponsableInterface|DeprecatedRedirectException $e) { 355 $this->outputBufferingEnd(); 356 if ($e instanceof DeprecatedRedirectException) { 357 $e = new RedirectException($e->getMessage(), $e->getCode(), $e); 358 } 359 360 $this->response = $e->getResponse(); FCPATH\index.php : 79 — CodeIgniter\CodeIgniter->run () 72 *--------------------------------------------------------------- 73 * LAUNCH THE APPLICATION 74 *--------------------------------------------------------------- 75 * Now that everything is set up, it's time to actually fire 76 * up the engines and make this app do its thang. 77 */ 78 79 $app->run(); 80 81 // Save Config Cache 82 // $factoriesCache->save('config'); 83 // ^^^ Uncomment this line if you want to use Config Caching. 84 85 // Exits the application, setting the exit code for CLI-based applications 86 // that might be watching.
@sushan
Routing configuration has changed. Pay attention to this: https://codeigniter.com/user_guide/insta...outing-php Regards, Frederik
Hi, thanks for reply, is not working for me : issue open
(08-25-2023, 06:33 AM)ALTITUDE_DEV Wrote: I have a question about how the hot reload bar works. I didn't quite understand it, could you please explain? Before now, when you update pages of your website, for example, change some text, you will need to go to your browser to click on the reload button. With the hot reloading feature, the system automatically detects changes in files within your app directory and reload your browser for you. See docs. ![]()
Thank you Loonie for hot realoading support! I was just thinking about how I could implement it by myself and now I have it with almost no configuration. It is really helping me with frontend, but I am eager to test it with backend too. Thank you again. It is big quality of development improvement for me.
(08-28-2023, 06:16 PM)kenjis Wrote: @chaos Did you customize Services for URI or Request? Hello any help about this? this piece of code writes in to a database a text. The text is loaded from the database and should show a link to click where one can see a battle report. If i use anchor in a view no problem, the assert doesn't fail. However if i use anchor helper in a Model (like in the code below) I have the error displayed below. What am i doing wrong? before it used to work. CODE Code: $characterevent_model->add(1, 'towncrier', "App.event_battleexecuted;". $this->battle['id'] ."," . ERROR Code: assert($currentURI instanceof SiteURI)
@chaos Show all backtrace and minimum code to reproduce the error.
(09-06-2023, 02:05 PM)kenjis Wrote: @chaos Show all backtrace and minimum code to reproduce the error. Sure. Put this in a Model: PHP Code: function replicate_bug () Code: [AssertionError]
I cannot reproduce the error.
I see "<a href="http://localhost:8080/index.php/battle/view/4">here</a>". PHP Code: <?php PHP Code: <?php (09-07-2023, 01:53 AM)kenjis Wrote: I cannot reproduce the error. Note: I checked and I did not extend or replace/customize the URI or Request Service. Did you try to reproduce it by calling the method from CLI? I added a debug message and if i browse the app the uri returned is correct: $currentURI CodeIgniter\HTTP\SiteURI#21 (20) While if i call the method in the Model from CLI and i type from ms-dos: Code: >php public\index.php battle replicate_bug I have wrong URI: PHP Code: CodeIgniter\HTTP\URI#19 (15) ( |
Welcome Guest, Not a member yet? Register Sign In |