Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

Fatal error when routing to page that is not found

admin

Started by Jamie Pickett 6 years ago · 1 replies · 505 views
6 years ago

I have a route using a regex (simplified for posting reasons)

TXT
'/technologies/([^/]*)/gettingstarted/?': '/gettingstarted/$1'

When testing it out, hitting 'technologies/analytics/gettingstarted' will route properly to '/gettingstarted/analytics'. However, I if try and hit 'technologies/ai/gettingstarted' I am presented with:

TXT
a **Fatal error** : Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in  **/var/www/html/system/src/Grav/Common/Page/Pages.php**  on line  **511**

The routed result would be looking for '/gettingstarted/ai', but that content does not exist. I was expecting to be returned with a 404 page.

Any help would be greatly appreciated.

6 years ago

Further investigation and it seems that on/around line 558 of system/src/Grav/common/Page/Pages.php will get stuck in a loop until memory exceeds. I have written a workaround in the file inside of this condition:

PHP
// Try Regex style routes
$site_routes = $config->get('site.routes');
if (is_array($site_routes)) {
  ...

But I am wondering if this is something that can be brought up with the Grav development staff.

Suggested topics

Topic Participants Replies Views Activity
Support · by Paul Hodges, 4 weeks ago
19 485 5 days ago
Support · by Lauw, 7 days ago
2 101 7 days ago
Support · by Anna, 3 weeks ago
4 426 1 week ago
Support · by gtx, 4 weeks ago
4 377 3 weeks ago
Support · by Anna, 1 month ago
9 484 4 weeks ago