BUGFIX #2820: Fixed use of buggy reflection in Object::uninherited()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@65899 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-11-14 00:56:53 +00:00
parent 4e2388848b
commit 10de47dc74

View File

@ -343,18 +343,11 @@ class Object {
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!
}
// isset() can handle the case where a variable isn't defined; more reliable than reflection
$propertyName = get_parent_class($this) . "::\$$name";
$val2 = eval("return isset($propertyName) ? $propertyName : null;");
return ($val != $val2) ? $val : null;
}