ID:               36675
 Updated by:       [EMAIL PROTECTED]
 Reported By:      iain at iaindooley dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: FreeBSD 6.0
 PHP Version:      5.1.3RC3-dev
 New Comment:

I'm afraid the hacked patch won't help. 
ATM you're the only one person in this world who can reproduce it, so
please provide a short but complete reproduce case.
Please reopen the report when you have it.
Thank you.


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

[2006-11-11 02:30:25] iain at iaindooley dot com

Yes, I had already stated that I could not recreate a simple test case,
please read the entire bug report. I've also provided a hacked patch
which stops the notice from appearing, although I'm informed by TML in
##php that what I have done is wrong, and doesn't actually 'fix'
anything.

I've updated most of my code to use is_object instead of boolean
comparisons to get around this, but it pops up from time to time.

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

[2006-11-11 01:09:16] [EMAIL PROTECTED]

<?php
class test {
}

$var = new test;

var_dump($var == "");
var_dump($var == "non-empty");
?>
works perfectly fine.

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

[2006-04-10 23:45:15] iain at iaindooley dot com

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.

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

[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.

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

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

Reply via email to