ID:               43545
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mark at dynom dot nl
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Linux
 PHP Version:      5.2.5
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php




Previous Comments:
------------------------------------------------------------------------

[2007-12-09 14:49:30] mark at dynom dot nl

Description:
------------
When comparing objects with integer types the notice:

"PHP Notice:  Object of class Foo could not be converted to int in
Command line code on line 1"

is raised, this only happens when not using strict checks (== vs ===)
It has been tested on multiple builds 5.1.6, 5.2.2, 5.2.4 and 5.2.5.

Reproduce code:
---------------
FAILS
php -r 'error_reporting( E_ALL ); class Foo { } $foo = new Foo;
var_dump( in_array($foo, array(0)) );'

WORKS
php -r 'error_reporting( E_ALL ); class Foo { } $foo = new Foo;
var_dump( in_array($foo, array("foo")) );'


// More examples: http://pasteosaurus.com/44812

Expected result:
----------------
I exepected to get: bool(false)

Actual result:
--------------
$ php -r 'error_reporting( E_ALL ); class Foo { } $foo = new Foo; if
($foo == 1) {}';

Notice: Object of class Foo could not be converted to int in Command
line code on line 1

Call Stack:
    0.0001      68456   1. {main}() Command line code:0



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43545&edit=1

Reply via email to