mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FIX: Fix ViewableData::__isset() for getXXX() getters.
PHP7 is stricter about this. Manual cherry-pick of of c80417a949c7f2821ab4ce1f76ccbc5b6649fcaf
This commit is contained in:
parent
22ad39e5ae
commit
f083a06f3f
@ -93,7 +93,18 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset($property) {
|
||||
return $this->hasField($property) || ($this->failover && $this->failover->hasField($property));
|
||||
// getField() isn't a field-specific getter and shouldn't be treated as such
|
||||
if (strtolower($property) !== 'field' && $this->hasMethod($method = "get$property")) {
|
||||
return true;
|
||||
|
||||
} elseif ($this->hasField($property)) {
|
||||
return true;
|
||||
|
||||
} elseif ($this->failover) {
|
||||
return isset($this->failover->$property);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,13 +115,17 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($property) {
|
||||
if($this->hasMethod($method = "get$property")) {
|
||||
// getField() isn't a field-specific getter and shouldn't be treated as such
|
||||
if (strtolower($property) !== 'field' && $this->hasMethod($method = "get$property")) {
|
||||
return $this->$method();
|
||||
} elseif($this->hasField($property)) {
|
||||
|
||||
} elseif ($this->hasField($property)) {
|
||||
return $this->getField($property);
|
||||
} elseif($this->failover) {
|
||||
|
||||
} elseif ($this->failover) {
|
||||
return $this->failover->$property;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user