obj == null check generates E_NOTICE

php.internals

Hans Lellelid

22 years ago
obj == null checks now trigger E_NOTICE class Foo { } $t = new Foo(); if ($t == null) { } Notice - Object of class Foo could not be converted to boolean Changing the comparison to $t === null makes the notice go away. Is this intended? If not I can post it as a bug report. Thanks, Hans

Andi Gutmans

22 years ago
At 11:21 AM 3/15/2004 -0500, Hans Lellelid wrote:
>obj == null checks now trigger E_NOTICE > >class Foo { >} > >$t = new Foo(); > >if ($t == null) { >} > >Notice - Object of class Foo could not be converted to boolean > > >Changing the comparison to $t === null makes the notice go away. Is this >intended? If not I can post it as a bug report.
I already fixed this. We added a bit too aggressive notice :) Now it's not quite as aggressive as I would like it to be but it behaves like in PHP 4. Andi