Permalink
Browse files

Hack to fix Fatal error: Call to undefined method stdClass::allMethod…

…Names()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.1.0@42503 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 40dc960 commit 1f9e0631800a684e5de975fd4df907b244b7b77e @ajoneil ajoneil committed with sminnee Sep 24, 2007
Showing with 6 additions and 3 deletions.
  1. +6 −3 core/Object.php
View
@@ -200,9 +200,12 @@ public function __call($methodName, $args) {
protected function addMethodsFrom($parameterName, $arrayIndex = null) {
$obj = isset($arrayIndex) ? $this->{$parameterName}[$arrayIndex] : $this->$parameterName;
if(!$obj) user_error("Object::addMethodsFrom: $parameterName/$arrayIndex", E_USER_ERROR);
- $methodNames = $obj->allMethodNames(true);
- foreach($methodNames as $methodName) {
- Object::$extraMethods[$this->class][$methodName] = array("parameterName" => $parameterName, "arrayIndex" => $arrayIndex);
+ // Hack to fix Fatal error: Call to undefined method stdClass::allMethodNames()
+ if(method_exists($obj, 'allMethodNames')) {
+ $methodNames = $obj->allMethodNames(true);
+ foreach($methodNames as $methodName) {
+ Object::$extraMethods[$this->class][$methodName] = array("parameterName" => $parameterName, "arrayIndex" => $arrayIndex);
+ }
}
}

0 comments on commit 1f9e063

Please sign in to comment.