PHP Fatal error: Call to a member function ... on a non-object : is case-sensitivity
12,762
Of what I can see:
error_log(gettype($userform));
error_log(method_exists($userform, "convert")); //$userform
$result = $userForm->convert($arrData); //$userForm
The convert method exists for $userform, but not $userForm, which is what you're calling the method on. PHP variable names are case sensitive.
Comments
-
James Newton almost 2 years
PHP 5.2 reports a "PHP Fatal error: Call to a member function convert() on a non-object" although I specifically check that the object exists and that it contains the required method.
Here is the PHP:
error_log(gettype($userform)); error_log(method_exists($userform, "convert")); $result = $userForm->convert($arrData);
And here are the appropriate extracts from the error log:
[...] object [...] 1 [...] PHP Fatal error: Call to a member function convert() on a non-object in /file/name.php on line 140
And here is the method itself:
public function convert(&$arrData) { // Bare-bones code return true; }
What am I overlooking?