#45360 [Opn]: Variable copies corrupted by memcache problem
| From: | richc at drivecurrent dot com | Date: | Wed, 25 Jun 2008 20:32:03 +0000 |
| Subject: | #45360 [Opn]: Variable copies corrupted by memcache problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126026@lists.php.net to get a copy of this message | ||
ID: 45360
User updated by: richc at drivecurrent dot com
Reported By: richc at drivecurrent dot com
Status: Open
Bug Type: Variables related
Operating System: Linux Redhat
PHP Version: 5.2.6
New Comment:
The last "Expected Result" should read
4 double / double / double
Previous Comments:
------------------------------------------------------------------------
[2008-06-25 20:24:42] richc at drivecurrent dot com
Description:
------------
I believe a problem with memcache reveals a problem with PHP. (PECL
Memcache bug: http://pecl.php.net/bugs/bug.php?id=14239)
A call to memcache changes the parameter variable to 'string' type. The
PHP problem is that this conversion is passed to ancestor and decendent
copies of the variable, even through function calls, even though passed
by value, not reference.
This appears to be similar to PHP Bug #42813, closed as Bogus. This is
a newly compiled PHP installation using latest PHP, PECL, memcached.
Reproduce code:
---------------
$value1 = 1.2;
$value2 = $value1; // this value is being passed -- all get modified
$value3 = $value2;
echo '<br>1 ' . gettype($value1) . ' / ' . gettype($value2) . ' /
' .
gettype($value3);
set('asdf', $value2);
echo '<br>4 ' . gettype($value1) . ' / ' . gettype($value2) . ' /
' .
gettype($value3);
function set( $key, $valueA ) {
$valueB = $valueA; // this value is being passed -- all get modified
$valueC = $valueB;
echo '<br>2 ' . gettype($valueA) . ' / ' . gettype($valueB) . ' /
' .
gettype($valueC);
$m = new Memcache();
$m->addServer('localhost');
$m->set($key, $valueB);
echo '<br>3 ' . gettype($valueA) . ' / ' . gettype($valueB) . ' /
' .
gettype($valueC);
}
Expected result:
----------------
Even when memcache bug corrupts $valueB, others should not be
affected:
1 double / double / double
2 double / double / double
3 double / string / double
4 double / string / double
Actual result:
--------------
1 double / double / double
2 double / double / double
3 string / string / string
4 string / string / string
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45360&edit=1