#33591 [NEW]: Reference-Flags not resetted
| From: | nobody at somewhere dot de | Date: | Wed, 06 Jul 2005 14:48:50 +0000 |
| Subject: | #33591 [NEW]: Reference-Flags not resetted | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-81488@lists.php.net to get a copy of this message | ||
From: nobody at somewhere dot de
Operating system: Linux
PHP version: 4.3.11
PHP Bug Type: Scripting Engine problem
Bug description: Reference-Flags not resetted
Description:
------------
I don't know about any php-Interna
Somehow a PHP-Variable seems to have a Flag that means "Is a Reference".
This Flag is not resetted under the conditions I show in the code below.
Cheers!
Reproduce code:
---------------
#---
global $ar;
$ar= array("[element of ar]");
var_dump($ar);
$ok= f();
$ok[0]= "[i DIDN'T set ar!]";
var_dump($ar);
$bug= & f();
$bug= f(); # bug! doesn't reset reference-flag
$bug[0]= "[i DIDN'T set ar!]";
var_dump($ar);
function & f() {
global $ar;
return $ar;
}
exit;
#---
Expected result:
----------------
array(1) { [0]=> string(15) "[element of ar]" }
array(1) { [0]=> string(15) "[element of ar]" }
array(1) { [0]=> string(15) "[element of ar]" }
Actual result:
--------------
array(1) { [0]=> string(15) "[element of ar]" }
array(1) { [0]=> string(15) "[element of ar]" }
array(1) { [0]=> string(18) "[i DIDN'T set ar!]" }
--
Edit bug report at http://bugs.php.net/?id=33591&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33591&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33591&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33591&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33591&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33591&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33591&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33591&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33591&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33591&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33591&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33591&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33591&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33591&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33591&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33591&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33591&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33591&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33591&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33591&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33591&r=mysqlcfg