Re: Fatal error: Call to a member function on a non-object

From: Date: Mon, 17 Nov 2008 09:31:29 +0000
Subject: Re: Fatal error: Call to a member function on a non-object
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-41959@lists.php.net to get a copy of this message
Hi. Christopher Vogt wrote:
I fetch records a database. Sometime it happens that a record does not exist anymore. Let's assume it's a user, then $user will be NULL. echo $user['fullname']; // no error at all, $user['fullname'] === NULL Shouldn't this at least trigger a Notice?
Check your error handling settings, probably warnings/notices are disabled.
echo $user->get_fullname(); // Fatal error
Well, is $user an object? If not, well, better not call a method on it. Regards, Karsten PS: I am not sure this is a topic for php.internals...

« previous php.internals (#41959) next »