#46277 [NEW]: implicit reference is not safe to use
| From: | ido at niger dot co dot il | Date: | Sun, 12 Oct 2008 10:26:04 +0000 |
| Subject: | #46277 [NEW]: implicit reference is not safe to use | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-129645@lists.php.net to get a copy of this message | ||
From: ido at niger dot co dot il
Operating system: Windows XP
PHP version: 5.3.0alpha2
PHP Bug Type: Scripting Engine problem
Bug description: implicit reference is not safe to use
Description:
------------
The example prints 9 as the value of $a , though it should be 8;
The fact the referencing $a[0] causes $a[0] to become a reference itself ,
is dangerous in cases like this where it is possible to change the value of
$a[0] though it was not originally defined as a reference.
Reproduce code:
---------------
function a($c){
$c[0] = 9;
}
$a[0] = 8;
$c = &$a[0];
a($a);
echo $a[0];
Expected result:
----------------
The value of $a should be 8
Actual result:
--------------
The value printed is 9
--
Edit bug report at http://bugs.php.net/?id=46277&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46277&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46277&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46277&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46277&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=46277&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46277&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46277&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46277&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46277&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46277&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46277&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46277&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46277&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46277&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46277&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46277&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46277&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46277&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46277&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46277&r=mysqlcfg