mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
4e2388848b
commit
10de47dc74
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user