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.

Archive /

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

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

Problems accessing security groups


Go to End


5 Posts   57404 Views

Avatar
mmilo

Community Member, 9 Posts

1 February 2008 at 4:58pm

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

Avatar
SirSpammenot

Community Member, 9 Posts

5 February 2008 at 8:24pm

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.

Avatar
SirSpammenot

Community Member, 9 Posts

7 February 2008 at 7:30pm

Edited: 07/02/2008 7:34pm

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

Avatar
SirSpammenot

Community Member, 9 Posts

7 February 2008 at 8:24pm

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!

Avatar
David Fraser

Community Member, 2 Posts

5 March 2008 at 5:38am

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.