ID: 36675 User updated by: iain at iaindooley dot com Reported By: iain at iaindooley dot com Status: Open Bug Type: Class/Object related Operating System: FreeBSD 6.0 PHP Version: 5.1.3RC3-dev New Comment:
this hasn't been assigned yet and it will be a real inconvenience if this is not fixed in the next major release. as i've stated in the bug report, using the same behaviour in zend_operators.c for function: ZEND_API void convert_to_long_base(zval *op, int base) for compatibility mode fixes this problem. the title of this bug report is "Cannot use an object with boolean expression", not "Cannot compare object to empty string". so far i don't think this issue has received the attention it requires. Previous Comments: ------------------------------------------------------------------------ [2006-04-07 09:29:15] iain at iaindooley dot com Yes, the line: if($this->top_reference == $ref) also causes the error, and changing the code in zend_operators.c as i posted fixed the problem. doing: $var = FALSE; if($some_other_var) $var = new SomeObject(); if($var) echo('we got here'); makes perfect sense, this is a bug. ------------------------------------------------------------------------ [2006-04-07 09:21:28] [EMAIL PROTECTED] >this same notice is also caused by: >if($obj1 == $obj2) Did you try it? Please try and see. >please do not dismiss a bug without properly understanding > what is going on. Please don't claim anything if you didn't check it out yourself. >if this is sensless then why doesn't it fail with the >simple test case i provided? Because you're comparing objects to '', which is autoconverted to FALSE. Try to compare objects to non-empty strings and you'll the expected warning. It MAY change in the future, but this is not a bug, because comparing circles to squares doesn't make any sense. ------------------------------------------------------------------------ [2006-04-07 08:48:57] iain at iaindooley dot com haha i just notice that you (tony2001) were the one who stated: Dmitry, I guess we need to return at least objects index in this case. Or maybe use the same way we use when compatibility_mode is on. What do you think? which is clearly what my patch does, which has somehow been undone in later versions. why would you dismiss such a thourough bug report as being senseless?? you could at least have the decency to forward it on to someone else. ------------------------------------------------------------------------ [2006-04-07 08:44:45] iain at iaindooley dot com Wrong, this is not expected, as http://bugs.php.net/bug.php?id=33999 states, and this same notice is also caused by: if($obj1 == $obj2) please do not dismiss a bug without properly understanding what is going on. if this is sensless then why doesn't it fail with the simple test case i provided? ------------------------------------------------------------------------ [2006-04-07 08:37:04] [EMAIL PROTECTED] Comparing objects or resources to strings, booleans and integers is obviously senseless. This is expected behaviour. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/36675 -- Edit this bug report at http://bugs.php.net/?id=36675&edit=1