Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Fatal error when routing to page that is not found

admin

Started by Jamie Pickett 6 years ago · 1 replies · 535 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 complanar, 6 days ago
6 140 17 hours ago
Support · by Rick Beebe, 6 days ago
2 100 2 days ago
Support · by blu3prince, 3 days ago
0 52 3 days ago
Support · by alex, 4 days ago
2 92 3 days ago
Support · by Marcel, 2 weeks ago
1 143 4 days ago