From: henrysim78 at yahoo dot com
Operating system: Win2000
PHP version: 4.3.2
PHP Bug Type: Unknown/Other Function
Bug description: Setcookie set Cookie into %00 instead of erased
Description:
------------
I'm using PHP Ver.4.3.2
I have the same problem too, when use setcookie(<cookiename>), Cookie is
set to %00 instead of erased.
The problem happen when it hit this syntax :
if(isset($_COOKIE['register'])) {echo
$_COOKIE['register'];}
Neither isset or !empty function could detect whether it's empty or not.
It always return true, so it will try to display the value
$_COOKIE['register'] that has been deleted. It returned error message
:
Notice: Uninitialized string offset: 0 in D:\My Web\register.php on line
186
Thanks in advance.
Reproduce code:
---------------
setcookie("register[one]","Bill"); //Set the cookie
setcookie("register[two]","Jim");
setcookie("register") //Delete the cookie
if(isset($_COOKIE['register']['one']))
{echo $_COOKIE['register']['one'];
} else
{echo "COOKIE Not Exist";
}
Expected result:
----------------
It should display "COOKIE Not Exist" as the cookie has been deleted.
Actual result:
--------------
It try to display the value of deleted COOKIE. It generated error :
Notice: Uninitialized string offset: 0 in D:\My Web\register.php on line
186
--
Edit bug report at http://bugs.php.net/?id=25221&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25221&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25221&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25221&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25221&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25221&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25221&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25221&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25221&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25221&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25221&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25221&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25221&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25221&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25221&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25221&r=gnused