Logic bug in php 5.3

5

So… here we go again. After the ugly php 5.2 output buffer crashes, we now have the php 5.3 logic bugs:

$foo = 0;
var_dump('foo' == $foo); // true
var_dump($foo == 'foo'); // true
var_dump('foo' === $foo); // false
var_dump($foo === 'foo'); // false

If your scripts are returning completely unexplainable results on php 5.3 platforms, that's one possibility to keep in mind. I initially found it while looking into memcached-related problems.

The worst part of it, though, is that it's not a bug: it's a feature.

Filed under Blog, Highlights, WordPress by on #

Comments on Logic bug in php 5.3

December 11th, 2009

Malte @ 10:12 am #

You're shure that this is new to PHP 5.3?

December 21st, 2009

miqrogroove @ 8:52 am #

This is why you have to kick and scream in situations like Ticket #7748. Data types are twice as important in languages that don't enforce them.