That sounds about right. It pretty much described the behavior between
the two versions.

Thanks for the info.


On Tue, 13 Jul 2004 18:44:06 -0500, Michael Sims
<[EMAIL PROTECTED]> wrote:
> Curt Zirzow wrote:
> > * Thus wrote Josh Close:
> >> if($var)
> >>
> >> used to work for
> >>
> >> if($var != 0) or if($var != "0")
> >>
> >> but that doesn't seem to work since I upgrade. So I'm just going to
> >> do
> >>
> >> if((int)$var)
> >
> > I still think this is unnecessary
> >
> > if ("0") { echo '"0"'; }
> > if ("")  { echo '""'; }
> > if (0)   { echo 0; }
> >
> > As I pointed out earlier, are still all the same; this behaviour
> > hasn't changed.
> 
> I agree.  As I pointed out in my earlier message in this thread, based on
> the description that the OP gave (and the fact that he's using
> mssql_query()), I think he's getting bitten by the problems introduced by
> the fix for bug #25777:
> 
> http://bugs.php.net/bug.php?id=25777
> 
> Basically PHP used to trim trailing spaces from data being returned via the
> mssql and sybase extensions, and the fix for the above bug (in both
> extensions) was to stop this trimming.  In my case this introduced a new
> problem, because bit fields that contain simply '0' in the database come
> back with trailing spaces.  While this:
> 
> $ php -r 'if ("0") echo "Yes\n";'
> 
> produces no output (because "0" == false) this does:
> 
> $ php -r 'if ("0 ") echo "Yes\n";'
> 
> because "0 " != false.
> 
> I have a hunch that if the OP does a print_r() on their "$var", it will be a
> string that starts with zero and ends with one or more spaces.  Casting $var
> to int will restore the original behavior, but this is only because (int) "0
> " === 0 and 0 == false.  So basically the cast to int does fix the OP's
> problem but not for the reasons he believes.
> 
> Of course, that's a complete guess based off incomplete information.  I
> could be way off. :)
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
-Josh

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to