ID:               28711
 Comment by:       imprestavel at gameguru dot com dot br
 Reported By:      sikachu at beezone dot net
 Status:           Open
 Bug Type:         Unknown/Other Function
 Operating System: Windows 2000
 PHP Version:      5.0.0RC3
 New Comment:

I think php4 does that too (just tested, but register_globals is off)
Maybe you are confusing isset with empty


"isset -- Determine whether a variable is set
...
Returns TRUE if var exists; FALSE otherwise."


"empty -- Determine whether a variable is empty
...
empty() returns FALSE if var has a non-empty and non-zero value. In
otherwords, "", 0, "0", NULL, FALSE, array(), var $var;, and objects
with empty properties, are all considered empty. TRUE is returned if
var is empty."


You may find that information here:
http://www.php.net/isset
http://www.php.net/empty

Hope it helps


Previous Comments:
------------------------------------------------------------------------

[2004-06-09 16:46:18] sikachu at beezone dot net

Clearify the bug summary ...

------------------------------------------------------------------------

[2004-06-09 16:44:18] sikachu at beezone dot net

Change the version number in topic from RC2 to RC3 ...

------------------------------------------------------------------------

[2004-06-09 16:42:41] sikachu at beezone dot net

Description:
------------
I upgraded from PHP 4.3.4 to PHP 5.0 RC3 yesterday. When I tried to run
the script that check for the query string and then refresh to the
page, the query string return the invalid value. This behavior I found
only in PHP 5.0 RC3

I'll show you the result with these thing:
echo $QUERY_STRING;
isset($QUERY_STRING);
$QUERY_STRING == "";

For example, assume that the script URL is
http://somewhere.com/index.php

If I call it like this: http://somewhere.com/index.php?foo

echo $QUERY_STRING;    // show foo
isset($QUERY_STRING);  // return true
$QUERY_STRING == "";   // return false

But, here is the problem. If I call it like this:
http://somewhere.com/index.php

echo $QUERY_STRING;    // show ""(nothing)
isset($QUERY_STRING);  // return true  << unexpected
$QUERY_STRING == "";   // return true

The code that I use for test will be in the next section.

My PHP configuration based on php.ini-dist. I changed register_global
to be On, and then add php_mysql & php_mysqli extension to it.

Reproduce code:
---------------
if(isset($QUERY_STRING))
{
        echo "Your query string is defined\n";
}
if($QUERY_STRING == "")
{
        echo "Your query string is null\n";
}
if($QUERY_STRING == " ")
{
        echo "Your query string contain just a space\n";
}

echo "Here is your query string: '".$QUERY_STRING."'";

Expected result:
----------------
Your query string is null
Here is your query string: ''

Actual result:
--------------
Your query string is defined
Your query string is null
Here is your query string: ''


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28711&edit=1

Reply via email to