Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Mysterious Error


Go to End


2 Posts   1298 Views

Avatar
Phaiax

Community Member, 1 Post

12 August 2011 at 8:50am

Edited: 12/08/2011 8:50am

Hey All.

I found a little error, I would like to make public for anyone searching therefore. And maybe I get a tip.

The following error appears under the following conditions.

Requesting a site at the root: domain.de/
PHP Version: 5.2.17 (not in php 5.3. I think it is because php 5.3 has a GB )
Using own Decorators
In live and dev-Mode

The error:
Displaying a 500 Server Error page.
But if you make an echo "abc"; anywhere in the script, the site will display the echo, but no content or templates at all.

What is causing the error.
Sometimes (i think every 40 times of querying the page, there is shown a php-fatal error: too much memory: 1,5GB allocated).
Maybe it is because the script has sometimes a millisecond more time before it is killed.
(PS: on the server there is a memory limit of 80MB)

Where the error happens:
sapphire/core/model/DataObjectDecorator.php line 59 (+-1)

if(method_exists($extensionClass, 'extraDBFields')) {

The script enters the method_exists().
Right after that, the silverstripe autoload method is called. The method includes the requested Decorator-Class. Then the autoload method returns and the script dies. The method_exists() is never returned!

The script only dies when using Decorators. The script dies not, when calling the same Function with the same parameter (Decorator class) more ahead in the sapphire code. The script dies not when you delete all content in /tmp/... before. But if the cache content is restored by the first request, it will die the following requests. The script dies with flush=1 and flush=all. The script dies not when calling a page by URLSegment.

Because of that i think it is an bug in php that only appears when you call specific php-functions in a specific order with specific parameters.

Workaround:
call method_exists() with nonsense parameters the line before:

method_exists("ImageMawefndyrgergow439vw34agerDecorator", "extraDBFields");

// @deprecated 2.4 - use extraStatics() now, not extraDBFields()
if(method_exists($extensionClass, 'extraDBFields')) {

I hope it will help someone in future.

But maybe we can expose the underlying problem and not using that workaround. :-)

Greets
Daniel

Avatar
Willr

Forum Moderator, 5523 Posts

13 August 2011 at 3:11pm

Interesting issue, perhaps raise this on the bug tracker - open.silverstripe.org. There may not be an 'easy' fix for the underlining issue but at least as a ticket the core devs will take a look at it!