#21600 [NEW]: assign by reference function call changes variable contents
| From: | jhpacker at yahoo dot com | Date: | Sun, 12 Jan 2003 21:07:10 +0000 |
| Subject: | #21600 [NEW]: assign by reference function call changes variable contents | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-29833@lists.php.net to get a copy of this message | ||
From: jhpacker@yahoo.com
Operating system: Redhat 8
PHP version: 4.3.0
PHP Bug Type: Variables related
Bug description: assign by reference function call changes variable contents
under 4.3.0 with apache 2.0.40 I see this strange behavior with aliasing:
$foo = "Philip Johnson's \"Glass House\" remains one of the most famous
residences in the world.";
$foo =& bar($foo);
print $foo;
function bar($text){
return $text;
}
outputs: Philip Johnson's "Glass House" remains one of the most famous
residences in the worlh
This didn't happen under 4.2.3. Although really this was a mistake on my
part (I meant to do $foo = bar($foo)) it seems like strange behavior
nonetheless.
It's also strange to me that if I change
return $text;
to
return "$text";
it works as I would expect.
--
Edit bug report at http://bugs.php.net/?id=21600&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21600&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21600&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21600&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21600&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21600&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21600&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21600&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21600&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21600&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21600&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21600&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21600&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21600&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=21600&r=gnused