|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-06-29 14:28 UTC] tony2001 at phpclub dot net
[2006-06-29 14:41 UTC] michael at apison dot com
[2006-06-29 14:47 UTC] tony2001 at phpclub dot net
[2006-06-29 15:02 UTC] michael at apison dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 18:00:02 2025 UTC |
Description: ------------ Hi there, I am having a problem with boolean variables stored in the cache. They are converted to strings, making it impossible to check them against type when comparing (===) the results. Thanks Michael Reproduce code: --------------- $memcache = new Memcache; $memcache->connect('localhost', 11211) or die ("Could not connect"); $version = $memcache->getVersion(); echo "Server's version: ".$version."<br/>\n"; $tmp_var = true; $tmp_var2 = false; $memcache->set('key1', $tmp_var, false, 10) or die ("Failed to save data at the server"); echo "Store data in the cache (data will expire in 10 seconds)<br/>\n"; $memcache->set('key2', $tmp_var2, false, 10) or die ("Failed to save data at the server"); echo "Store data in the cache (data will expire in 10 seconds)<br/>\n"; $get_result = $memcache->get('key1'); echo "Data from the cache:<br/>\n"; var_dump($get_result); $get_result = $memcache->get('key2'); echo "<br />Data from the cache:<br/>\n"; var_dump($get_result); Expected result: ---------------- Server's version: 1.1.12 Store data in the cache (data will expire in 10 seconds) Store data in the cache (data will expire in 10 seconds) Data from the cache: bool(true) Data from the cache: bool(false) Actual result: -------------- Server's version: 1.1.12 Store data in the cache (data will expire in 10 seconds) Store data in the cache (data will expire in 10 seconds) Data from the cache: string(1) "1" Data from the cache: string(0) ""