# obj == null check generates E_NOTICE

- Thread: https://externals.io/message/8528
- Original archive: https://news-web.php.net/php.internals/8528
- Started by Hans Lellelid on 2004-03-15T16:21:35+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #8528 — Hans Lellelid — 2004-03-15T16:21:35+00:00

URL: https://externals.io/message/8528#8528

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

---

## #8530 — Andi Gutmans — 2004-03-15T16:31:12+00:00

URL: https://externals.io/message/8528#8530 · In reply to: #8528

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
