mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Stricter object type checks in ViewableData->hasValue() and ViewableData->XMLval(). Broke in cases when SS_HTTPResponse is returned which doesn't extend from Object, hence doesn't have an exist() method (fixes #5524, thanks hamish)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@105278 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
b7e66542ac
commit
24b365d4e2
@ -423,9 +423,10 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public function hasValue($field, $arguments = null, $cache = true) {
|
||||
$result = $cache ? $this->cachedCall($field, $arguments) : $this->obj($field, $arguments, false, false);
|
||||
|
||||
if(is_object($result)) {
|
||||
if(is_object($result) && $result instanceof Object) {
|
||||
return $result->exists();
|
||||
} else {
|
||||
// Empty paragraph checks are a workaround for TinyMCE
|
||||
return ($result && $result !== '<p></p>');
|
||||
}
|
||||
}
|
||||
@ -443,7 +444,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
*/
|
||||
public function XML_val($field, $arguments = null, $cache = false) {
|
||||
$result = $this->obj($field, $arguments, false, $cache);
|
||||
return is_object($result) ? $result->forTemplate() : $result;
|
||||
return (is_object($result) && $result instanceof Object) ? $result->forTemplate() : $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user