Bug #62976 [Com]: Notice: could not be converted to int when comparing some builtin classes
| From: | reeze dot xia at gmail dot com | Date: | Thu, 30 Aug 2012 17:40:24 +0000 |
| Subject: | Bug #62976 [Com]: Notice: could not be converted to int when comparing some builtin classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-173029@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62976&edit=1
ID: 62976
Comment by: reeze dot xia at gmail dot com
Reported by: ladislav at marek dot su
Summary: Notice: could not be converted to int when comparing
some builtin classes
Status: Open
Type: Bug
Package: Class/Object related
Operating System: Linux
PHP Version: 5.4Git-2012-08-30 (Git)
Block user comment: N
Private report: N
New Comment:
After the fix for #61326 ArrayObject have different compare_objects handler:
http://git.php.net/?p=php-
src.git;a=commit;h=23e65a9dcc71cf11ee5ec82c256588626545d4db
There is an test case the same as bug report:
https://github.com/php/php-src/blob/master/tests/lang/compare_objects_basic2.phpt
I agree with @laruence that it could be improved.
if both of the object couldn't be cast to compare. they ARE not equal.
Previous Comments:
------------------------------------------------------------------------
[2012-08-30 16:13:03] laruence@php.net
Arrayobject is share the same object handlers as stdClass, but exception does.
anyway, I think there is a room to improve..
------------------------------------------------------------------------
[2012-08-30 13:16:10] ladislav at marek dot su
Description:
------------
Comparing instance of some builtin class with instance of different class issues
notice: "Object of class ArrayObject could not be converted to int".
Test script:
---------------
new stdClass == new ArrayObject;
// but "new stdClass == new Exception" works without notice
Actual result:
--------------
Notice: Object of class ArrayObject could not be converted to int in Command line
code on line 1
Notice: Object of class stdClass could not be converted to int in Command line
code on line 1
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62976&edit=1