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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Fatal error when routing to page that is not found

admin

Started by Jamie Pickett 6 years ago · 1 replies · 422 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 Thomas, 1 week ago
3 92 3 hours ago
Support · by Anna, 3 days ago
2 94 24 hours ago
Support · by Justin Young, 1 day ago
1 62 1 day ago
Support · by Duc , 1 week ago
2 98 6 days ago
Support · by Colin Hume, 1 week ago
2 91 6 days ago