Bug #16955: 0 == NULL, but only sometimes! :)

2002-05-01 Thread claudio . frizziero

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=16955edit=1
-- 
Fixed in CVS:http://bugs.php.net/fix.php?id=16955r=fixedcvs
Fixed in release:http://bugs.php.net/fix.php?id=16955r=alreadyfixed
Need backtrace:  http://bugs.php.net/fix.php?id=16955r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=16955r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16955r=support
Expected behavior:   http://bugs.php.net/fix.php?id=16955r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16955r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16955r=submittedtwice




Bug #16955 Updated: 0 == NULL, but only sometimes! :)

2002-05-01 Thread claudio . frizziero

 ID:   16955
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
 Status:   Open
 Bug Type: Scripting Engine problem
 Operating System: Red Hat 6.2
 PHP Version:  4.2.0
 New Comment:

I find the problem:

$temp = 0; // is not // $temp = 0;

Sorry :)

However, I'd like to have 0  NULL in the future :) Don't you think?


Previous Comments:


[2002-05-01 17:20:37] [EMAIL PROTECTED]

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 this bug report at http://bugs.php.net/?id=16955edit=1