Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when a NUL char is used as key, apcu_fetch(array) truncates the key #247

Closed
nicolas-grekas opened this issue Jun 5, 2017 · 3 comments
Closed

Comments

@nicolas-grekas
Copy link

apcu_store(array("a\0b" => 'foo'));
print_r(apcu_fetch(array("a\0b")));

output:

Array
(
    [a] => foo
)

expected:

Array
(
    [a<non-displayed-nul>b] => foo
)
fabpot added a commit to symfony/symfony that referenced this issue Jun 5, 2017
…en (nicolas-grekas)

This PR was merged into the 3.3 branch.

Discussion
----------

[Cache] Fallback to positional when keyed results are broken

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Works around krakjoe/apcu#247 ~~and facebook/hhvm#7867

Commits
-------

28aaa8e [Cache] Fallback to positional when keyed results are broken
@7snovic
Copy link

7snovic commented Jul 29, 2017

I think that the expected result here is : [a\0b] => foo while as I see that the actual cache index is a\0b

@7snovic 7snovic mentioned this issue Jul 29, 2017
@nicolas-grekas
Copy link
Author

nicolas-grekas commented Aug 17, 2017

@7snovic nowhere else are values "addslashed"
this would be inconsistent with the way non-array calls behave (apcu_store("a\0b", 'foo')).

@7snovic
Copy link

7snovic commented Aug 23, 2017

@nicolas-grekas I will try to give an explanation for this ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants