Jump to:

5453 Posts in 1674 Topics by 1198 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Mysterious Error

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

Page: 1
Go to End
Author Topic: 681 Views
  • Phaiax
    Avatar
    Community Member
    1 Post

    Mysterious Error Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: Mysterious Error Link to this post

    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!

    681 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.