Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Problems accessing security groups

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 55839 Views
  • mmilo
    Avatar
    Community Member
    9 Posts

    Problems accessing security groups Link to this post

    I can't seem to access security groups or delete them. The error I get is below:

    Fatal error: Access to undeclared static property: Controller::$db in /home/vanguardhr/www/sapphire/core/Object.php(315) : eval()'d code on line 1

  • SirSpammenot
    Avatar
    Community Member
    9 Posts

    Re: Problems accessing security groups Link to this post

    Exact same issue here. The details page is just blank. If I set display_errors = On in php.ini I can see the same error.

    Fatal error: Access to undeclared static property: Controller::$db in
    /home/vhosts/mayarowlett.com/v2.2.1/sapphire/core/Object.php(315) : eval()'d code on line 1

    I can however see/use the tree control on the left hand side. create and delete groups happens OK.

    We are probably missing some feature of php, that has been the root of my SS problem(s) so far. So I am going down that road for now. Mo later.

  • SirSpammenot
    Avatar
    Community Member
    9 Posts

    Re: Problems accessing security groups Link to this post

    mmilo, do you have PHP v5.1.2? My openSuSE v10.1 server does.
    Apparently SS does NOT play well with that version.

    From /sapphire/core/Object.php (about line 315):

       function uninherited($name, $builtIn = false) {
          // Copy a built-in value into our own array cache. PHP's static variable support is shit.
          if($builtIn) {
             $val = $this->stat($name);
             $val2 = null;
             try {
                // The reflection doesn't work properly in 5.1.2
                if(phpversion() == '5.1.2') {
                   $val2 = eval('return ' . get_parent_class($this) . "::\$$name;");
                } else {
                   $reflection = new ReflectionClass(get_parent_class($this));
                   $property = $reflection->getProperty($name);
                   $val2 = $property->getValue();
                }
             } catch(Exception $exc) {
                // do nothing.. the property doesn't exists!
             }
             return ($val != $val2) ? $val : null;
          }

          return isset(Object::$uninherited_statics[$this->class][$name]) ? Object::$uninherited_statics[$this->class][$name] : null;
       }

    So, changing installed version of PHP is one fix... Trying to grok the code for a workaround.
    JF

  • SirSpammenot
    Avatar
    Community Member
    9 Posts

    Re: Problems accessing security groups Link to this post

    It was easier for me to update to php v5.2.0 on openSuSE v10.1:

    Add this repo: http://repos.opensuse.org/server:/php/SUSE_Linux_10.1/
    run YaST, software->install locations.
    Add URL, OK Finish.
    Then Software->Software Management
    Alt+S (search) for php, see that the available version is 5.2.0 (installed = 5.1.2).
    Update php, uninstall php-mysqli (I didn't seem to need it, and it is provided in the new rpm).
    the rcapache2 restart had weirdness, so I actually rebooted just to be sure.
    run php -v (or php5 -v) on command line to verify version.

    I can view the security page now. Good luck!

  • David Fraser
    Avatar
    Community Member
    2 Posts

    Re: Problems accessing security groups Link to this post

    I had this problem. Unfortunately, I do not have the option of upgrading 5.1.2 on my hosting provider. However, I have come up with this workaround:

    if(phpversion() == '5.1.2') {
    if (property_exists ( get_parent_class($this), $name)) {
    $val2 = eval('return ' . get_parent_class($this) . "::\$$name;");
    }

    The test for property_exists stops this eval from happening when the property does not exist, therefore stopping the problem occurring.

    55839 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.