From:             tokul at users dot sourceforge dot net
Operating system: Linux Debian Sarge
PHP version:      5CVS-2006-07-25 (snap)
PHP Bug Type:     Reproducible crash
Bug description:  variable name and cookie name match breaks script execution

Description:
------------
If PHP register_globals are turned on and code tries to unset globals,
unset command can break script execution. It is possible that issue is not
in unset() command. Maybe it is caused by some foreach() function changes
or some session/cookie handling changes.

Issue was reported on php-qa mailing list by Phil Driscoll
(http://news.php.net/php.qa/26841).

PHP 5.2.0rc2-dev (200607251030) snapshot. Compiled as Apache2 DSO module.
register_globals are turned on in php.ini. I can provide configure command
and php.ini settings, if you need them. error_reporting is set to E_ALL

Can't reproduce it in 5.1.4 or older versions.

Reproduce code:
---------------
<?php
if (!isset($_COOKIE['test'])) {
  setcookie('test','somevalue');
  echo 'reload script';
} else {
  foreach ($_REQUEST as $test => $value) {
    // code crashes on unset() call
    unset($GLOBALS[$test]);
  }
  echo time();
}
?>

Expected result:
----------------
script should display 'reload script' on first load and timestamp on
second load.

Actual result:
--------------
script displays 'reload script' on first load (cookie is not set) and
crashes without any visible error when it is reloaded.


-- 
Edit bug report at http://bugs.php.net/?id=38211&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38211&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38211&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38211&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38211&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38211&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38211&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38211&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38211&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38211&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38211&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38211&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38211&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38211&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38211&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38211&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38211&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38211&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38211&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38211&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38211&r=mysqlcfg

Reply via email to