JayT
09-13-2007, 11:30 PM
I'm using Windows XP Pro SP2 and PHP v4.4.4 installed on Microsoft IIS v5.*
I have been going insane because I think I've found a bug in PHP, or at least a strange problem that I can't seem to easily resolve. It has been causing some mysterious computational failures giving erroneous numeric results.
Is there someone here who can test a simple PHP function and see if they get a similar result?
I've never seen a problem like this before.
This following code prints out the value 5 when I run it.
<?PHP
print test(05);
function test ($arg)
{
return $arg;
}
?>
If I change the digits 05 to something else, such as 07, then it will print 7 as the result. That's what it should do. Nothing wrong with that.
Try changing the digits 05 to 0* and see what happens.
Every time I do that, I get 0 as the result!
Why does it fail ONLY if the digits are 0*?
I'm making a time input interface where the user enters the time as HH MM SS into three 2-digit text boxes on a form, one box for each time element.
A time such as 0*:0*:0* should also be able to be entered as *:*:*, but I can't get it to work that way.
The user should be able to enter a time as 06 or simply as 6 for 6 hours, minutes or seconds and shouldn't have to worry about the leading zero.
It seems to be only when the hours, minutes or seconds is 0*, that it fails and reads as zero. If I simply enter *, then it works perfectly! All other values from 00 to 08 work OK. The problem only occurs if the value is 0*.
I think it's a big, stinky, slimy PHP bug.
It took a long time to figure out why my computations were only occasionally wrong for an unknown reason and that bug(?) seems to be the cause of the problem.
The same result occurs even if more than one zero or more than one * is used.
For example, in the above function, the argument 000** returns zero and 00077* returns 6* !
The number * is evil, I tell you, EVIL !!!
Arghhhhhhhh!
I just want to know if the problem occurs for others using the same code or if the problem is unique to me.
PS: Apparently it happens with 08 too!
Rats!
I have been going insane because I think I've found a bug in PHP, or at least a strange problem that I can't seem to easily resolve. It has been causing some mysterious computational failures giving erroneous numeric results.
Is there someone here who can test a simple PHP function and see if they get a similar result?
I've never seen a problem like this before.
This following code prints out the value 5 when I run it.
<?PHP
print test(05);
function test ($arg)
{
return $arg;
}
?>
If I change the digits 05 to something else, such as 07, then it will print 7 as the result. That's what it should do. Nothing wrong with that.
Try changing the digits 05 to 0* and see what happens.
Every time I do that, I get 0 as the result!
Why does it fail ONLY if the digits are 0*?
I'm making a time input interface where the user enters the time as HH MM SS into three 2-digit text boxes on a form, one box for each time element.
A time such as 0*:0*:0* should also be able to be entered as *:*:*, but I can't get it to work that way.
The user should be able to enter a time as 06 or simply as 6 for 6 hours, minutes or seconds and shouldn't have to worry about the leading zero.
It seems to be only when the hours, minutes or seconds is 0*, that it fails and reads as zero. If I simply enter *, then it works perfectly! All other values from 00 to 08 work OK. The problem only occurs if the value is 0*.
I think it's a big, stinky, slimy PHP bug.
It took a long time to figure out why my computations were only occasionally wrong for an unknown reason and that bug(?) seems to be the cause of the problem.
The same result occurs even if more than one zero or more than one * is used.
For example, in the above function, the argument 000** returns zero and 00077* returns 6* !
The number * is evil, I tell you, EVIL !!!
Arghhhhhhhh!
I just want to know if the problem occurs for others using the same code or if the problem is unique to me.
PS: Apparently it happens with 08 too!
Rats!