php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45122 Memcache using references where none exists
Submitted: 2008-05-28 21:39 UTC Modified: 2008-05-29 22:57 UTC
From: flebron at bumeran dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.6 OS: Fedora Linux
Private report: No CVE-ID: None
 [2008-05-28 21:39 UTC] flebron at bumeran dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-29 22:57 UTC] jani@php.net
There is no memcache extension in PHP. You should report bugs in PECL extensions at: http://pecl.php.net/bugs/report.php?package=memcache
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Aug 18 22:00:03 2025 UTC