PHP 4.0 Bug #6031: concating return values to a string?
| From: | lg at netside dot de | Date: | Tue, 08 Aug 2000 23:13:57 +0000 |
| Subject: | PHP 4.0 Bug #6031: concating return values to a string? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-28151@lists.php.net to get a copy of this message | ||
From: lg@netside.de
Operating system: Linux
PHP version: 4.0.1pl2
PHP Bug Type: Misbehaving function
Bug description: concating return values to a string?
Look at this code:
function strhex($ni) {
$ni=dechex($ni);
while (strlen($ni)<2) $ni="0".$ni;
return $ni;
}
$color=strhex($r).strhex($g).strhex($b);
echo $color;
it works fine if nothing else in a file :(
I have one file using that code that's not working under PHP4, but works great under PHP3.
(same server, different port) :(((
so I tried
$color=strhex($r);
$color.=strhex($g);
$color.=strhex($b);
instead the last line and it worked fine. I could'nt find any error, so I thought this may be
interesting 4 you (whether I know this error - if it is one - might be hard to find and the
description is)...
I also tracked that variables... the function calculates the correct value (e.g. "9b")
every time, but the 3 values are not concated in the right way (its running in a loop, any second
cicle all values are calculated correct, but I only get "9b9b" instead of
"9b9b9b"; the other cicle everything is OK)
PHP(4) is compiled using the standard settings with the latest apache stable (.12) and mysql.libs
sorry for my english & stay tuned
Lars