This is a strange behavior. If the original class have no predefined variables, then if the object's constructor does no assignment of its own, the resulting object compares to null, e.g. class foo { var $bar; function foo() { // do nothing } } $o = new foo(); if ($o == null) echo "boom!"; if (empty($o)) echo " zap!"; Outputs "boom! zap!", even when the object was created. Are we assuming than an object w/ no defined member vars is a null object? Not sure that is the expected behavior, but I might be wrong. Adding a predefined var in the class definition or setting one in the constructor, "fixes" the problem. Tested it w/ PHP 4.0.4pl1 and latest PHP from CVS (both compiled as stand alone executables) --- [EMAIL PROTECTED] wrote: > Date: 18 Mar 2001 05:33:38 -0000 > To: [EMAIL PROTECTED] > From: [EMAIL PROTECTED] > Subject: [PHP-NOTES] note 12009 added to > language.oop.php > > I wondered why the "new" assignments in these > examples were never tested for success --- ie. > if(!($var = new Cart())) echo "failure"; > > Now I know (at least for PHP4.0.4pl1). > > The test ALWAYS fails unless the constructor of the > class does a local member variable assignment. > > This I don't like. Could someone please explain to > me why this is a "good thing"? > > http://www.php.net/manual/en/language.oop.php > > > -- > PHP Notes Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > ===== --- Jesus M. Castagnetto <[EMAIL PROTECTED]> __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]