php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59046 Problems if "\0" within the key
Submitted: 2010-01-26 04:44 UTC Modified: 2010-03-05 03:18 UTC
From: marc dot bennewitz at giata dot de Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5_3.1RC2 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: marc dot bennewitz at giata dot de
New email:
PHP Version: OS:

 

 [2010-01-26 04:44 UTC] marc dot bennewitz at giata dot de
Description:
------------
Sometimes if the key has the "\0"-character within caching storing or reading of this item fails.

Reproduce code:
---------------
apc_store("\0", "test1");
var_dump(apc_exists("\0"));
var_dump(apc_fetch("\0"));

apc_store("-\0-", "test2");
var_dump(apc_exists("-\0-"));
var_dump(apc_fetch("-\0-"));

apc_store("-\1-", "test3");
var_dump(apc_exists("-\1-"));
var_dump(apc_fetch("-\1-"));

Expected result:
----------------
bool(true)
string(5) "test1"
bool(true)
string(5) "test2"
bool(true)
string(5) "test3"

Actual result:
--------------
bool(true)
string(5) "test1"
NULL
bool(false)
bool(true)
string(5) "test3"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-05 02:19 UTC] kalle@php.net
This is because those functions are not binary safe
 [2010-03-05 02:24 UTC] rasmus@php.net
The values are binary safe, but the keys aren't.  I don't see 
any real reason to change that.  It simplifies things to have 
null-terminated keys.
 [2010-03-05 03:18 UTC] marc dot bennewitz at giata dot de
ok, but than it should report a warning/notice and return false instead of null on storing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 11:01:27 2024 UTC