getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.31k stars 168 forks source link

[Cms] Exhausted when using url() in config #475

Closed jenstornell closed 6 years ago

jenstornell commented 6 years ago

Config (modified from the new starterkit)

return [
    'debug'  => true,
    'test' => url('assets/images/picture.png'),
    'routes' => [
        [
            'pattern' => 'team/(:any)',
            'action'  => function ($hash) {
                return go('team/#' . $hash);
            }
        ],
        [
            'pattern' => 'one-pager/(:any)',
            'action'  => function ($hash) {
                return go('one-pager/#' . $hash);
            }
        ]
    ]
];

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65536 bytes) in D:\projects\kirby\3.0-alpha-10\kirby\config\urls.php on line 15

distantnative commented 6 years ago

Could you please check if that problem still exists?

distantnative commented 6 years ago

Yes, still exists:

[09-Jul-2018 19:26:22 Europe/Berlin] PHP Fatal error:  Uncaught Error: Maximum function nesting level of '256' reached, aborting! in starterkit/kirby/src/Cms/Ingredients.php:35
Stack trace:
#0 starterkit/kirby/src/Cms/Ingredients.php(35): is_a(Object(Closure), 'Closure')
#1 starterkit/kirby/src/Cms/App.php(118): Kirby\Cms\Ingredients::bake(Array)
#2 starterkit/kirby/src/Cms/App.php(70): Kirby\Cms\App->bakeRoots(Array)
#3 starterkit/kirby/src/Cms/App.php(258): Kirby\Cms\App->__construct()
#4 starterkit/kirby/src/Cms/Url.php(25): Kirby\Cms\App::instance()
#5 starterkit/kirby/src/Http/Url.php(132): Kirby\Cms\Url::home()
#6 starterkit/kirby/src/Http/Url.php(218): Kirby\Http\Url::makeAbsolute('assets/images/p...')
#7 starterkit/kirby/config/helpers.p in starterkit/kirby/src/Cms/Ingredients.php on line 35
bastianallgeier commented 6 years ago

We can't fix that. We have the url option and the url function relies on that one. This will always end in a loop.