From: flebron at bumeran dot com
Operating system: Fedora Linux
PHP version: 5.2.6
PHP Bug Type: Unknown/Other Function
Bug description: Memcache using references where none exists
Description:
------------
Memcache somehow obtains a reference where none exists. In the example, I
set $clave to a string, set $keyword to a copy of $clave (since $clave is a
string, I'm assuming it internally is copied by value, not reference, as
per the docs?), and then do something with $clave. At the end of this
mucking, $keyword is changed, replacing a space with an underscore.
The problem does NOT occur if I say $keyword = substr($clave, 0); instead
of $keyword = $clave, so I'm assuming it's somehow obtaining a reference?
(The script starts and ends at the <?php and ?> sections, there's nowhere
that says global $keyword or anything).
The memcached server version is 1.2.1, running on Apache 2.0.53.
Reproduce code:
---------------
<?php
$a = memcache_pconnect("192.168.1.252", 11211);
$clave = "abc 123";
$keyword = $clave;
echo "K: ".$keyword."<br/>";
$a->get($clave);
echo "K: ".$keyword."<br/>";
?>
Expected result:
----------------
K: abc 123
K: abc 123
Actual result:
--------------
K: abc 123
K: abc_123
--
Edit bug report at http://bugs.php.net/?id=45122&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45122&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45122&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45122&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45122&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45122&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45122&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45122&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45122&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45122&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45122&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45122&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45122&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45122&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45122&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45122&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45122&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45122&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45122&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45122&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45122&r=mysqlcfg