|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-01-29 00:46 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 05:00:01 2025 UTC |
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