ID:               45360
 User updated by:  richc at drivecurrent dot com
 Reported By:      richc at drivecurrent dot com
 Status:           Bogus
 Bug Type:         Variables related
 Operating System: Linux Redhat
 PHP Version:      5.2.6
 New Comment:

** Could someone please take a look at this bug instead of closing as
bogus. This is NOT simply a memcache bug unless PHP allows memcache to
corrupt variables outside its context--which still makes it a PHP bug.
This is a PHP bug revealed by the memcache bug. Please take another
look.


Previous Comments:
------------------------------------------------------------------------

[2008-07-02 11:50:02] [EMAIL PROTECTED]

Memcache bugs are not PHP bugs -> bogus.

------------------------------------------------------------------------

[2008-06-25 20:32:03] richc at drivecurrent dot com

The last "Expected Result" should read
  4 double / double / double

------------------------------------------------------------------------

[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

Reply via email to