Hej,

I use PHP 5.2.6. I am refactoring some code to use more
object-orientation. I encounter a problem, where the new object-oriented
version results in a fatal error, where the old array-oriented version
didn't.

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?

echo $user->get_fullname(); // Fatal error

I agree this should trigger an error, but a "Fatal error" is a little
too much, I think. It terminates the script leaving the html-document
incomplete. I would prefer a "Warning" and NULL instead.

Is there any reason against it?

Best regards

Christopher

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to