php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58250 Memcache::set() modifies value parameter
Submitted: 2008-06-25 15:50 UTC Modified: 2008-06-25 16:27 UTC
From: richc at drivecurrent dot com Assigned:
Status: Closed Package: memcache (PECL)
PHP Version: 5.2.5 OS: Linux Redhat
Private report: No CVE-ID: None
 [2008-06-25 15:50 UTC] richc at drivecurrent dot com
Description:
------------
Caller copy of "value" parameter is changed to string type by a call to set().

This bug is similar to Bug #9514 PHP Memcache::get modifies his second argument.

When caller program passes var with boolean, integer or float, the caller's copy of that var is changed to string type. Does not happen with array or object.

The caller's copy of the var should not be modified.

As with Bug #9514, preventing "by reference" passing stops problem: set($key, $value . '').

Reproduce code:
---------------
$m = new Memcache();
$m->addServer('localhost');

$value = 1.2;
echo gettype($value);

$m->set('asdf', $value);
echo '<br>';
echo gettype($value);

Expected result:
----------------
double
double

Actual result:
--------------
double
string

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-25 16:27 UTC] mikael at synd dot info
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 01:01:28 2024 UTC