From: [EMAIL PROTECTED] Operating system: Red Hat 6.2 PHP version: 4.2.0 PHP Bug Type: Scripting Engine problem Bug description: 0 == NULL, but only sometimes! :)
Hello! i might have found a problem dealing with 0 and NULL values while using a recursive function in a class that i have created. I have found some bugs related to this problem in the php-bugs database about "0" and "NULL", but the problem i have found goes more into depth: i've noticed that 0 == NULL only if the value "0" only if the value "0" comes from the array passed to the recurvise function. i try to explain with an example: $temp = $a[$p]; if ($temp == "") { if ($temp == "0") { echo ("impossible"); } } it happens that the output will be "impossible". instead, if i set $temp = "0" or NULL before the IF structures, i won't get the output "impossible": $temp = $a[$p]; $temp = "0"; // or $temp = NULL; // or without declaring at all the variable $temp if ($temp == "") { if ($temp == "0") { echo ("Impossible"); } } $a is an array which can be modified or not by the recursive function, and is then passed as a parameter to the function itself I have tested it both with version 4.0.5 and 4.2.0 If you would like to receive more details about this, i will be glad to send you the complete source code. i have tried to reduce the lenght of the code, anyway it's still too long to write here. if you are interested, i could send you all the code by email or i could give you an account to access my server and work by ftp/http best regards, and thank you for developing PHP :) Claudo Frizziero --- configure line: configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs --with-jpeg-dir=/usr/local/bin --with-gd=/usr/ --enable-ftp -- Edit bug report at http://bugs.php.net/?id=16955&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16955&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16955&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16955&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16955&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16955&r=support Expected behavior: http://bugs.php.net/fix.php?id=16955&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16955&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16955&r=submittedtwice