Doc #54894 [NEW]: array copy semantics with references inside arrays
| From: | mlvl dot jr at gmail dot com | Date: | Fri, 20 May 2011 13:46:36 +0000 |
| Subject: | Doc #54894 [NEW]: array copy semantics with references inside arrays | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-6645@lists.php.net to get a copy of this message | ||
From:
Operating system: any
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:array copy semantics with references inside arrays
Description:
------------
There probably should be an explicit reference to this:
"While not being strictly an assignment by reference, expressions created
with the language construct array() can also behave as such by prefixing &
to the array element to add.
The page also explains your why your first code behaves like it does:
Note, however, that references inside arrays are potentially dangerous.
Doing a normal (not by reference) assignment with a reference on the right
side does not turn the left side into a reference, but references inside
arrays are preserved in these normal assignments. This also applies to
function calls where the array is passed by value." (taken from
http://www.php.net/manual/en/language.references.whatdo.php)
at the documentation page for 'array':
http://php.net/manual/en/language.types.array.php
[coming from
http://stackoverflow.com/questions/6072444/php-array-copy-semantics-what-it-does-when-members-are-references-and-where-is/]
--
Edit bug report at http://bugs.php.net/bug.php?id=54894&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54894&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54894&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54894&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54894&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54894&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54894&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54894&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54894&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54894&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54894&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54894&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54894&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54894&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54894&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54894&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54894&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54894&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54894&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54894&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54894&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54894&r=mysqlcfg