RE: [PHP] php 4.3.7/5.0
| From: | Michael Sims | Date: | Tue, 13 Jul 2004 19:43:16 +0000 |
| Subject: | RE: [PHP] php 4.3.7/5.0 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190382@lists.php.net to get a copy of this message | ||
Josh Close wrote:
> $result = mssql_query($sql);
> $row = mssql_fetch_array($result);
> $var = $row[0];
>
> So it should be an int. And if it's copied into a function it
> shouldn't be changed.
>
> But doing
>
> if($var)
>
> doesn't seem to work after I upgraded versions. Which is making me
> think that they changed how that works.
>
> And using is_string() or is_int() is pointless 'cause it doesn't
> matter. I just want to know if the value != 0.
>
> The problem is, if 0 gets changed to "0" somewhere throughout. That's
> why I've always used if($var) because it's usually not cared what the
> type is, but it seems to now.
This sounds an awful lot like the problem I experienced with PHP's Sybase extension
after upgrading to PHP 4.3.4. Is your query retrieving data from a bit field ('0'
or '1')? If so, you might want to read this:
http://marc.theaimsgroup.com/?l=php-dev&m=108377430919818&w=2
I never did get a response to it. I've had it on my TODO list to open it as a bug
for the longest time, but I haven't had a chance to come up with minimal reproduce
code and I frankly haven't had the time to deal with it. I managed to work around
the problem by maintaining a local patch to PHP to undo the change mentioned in my
post above. Let me know if this is your issue and I can explain more and/or provide
my simple patch.