Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
cache system
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
13 May 2014 at 04:36 UTC
Updated:
29 Jul 2014 at 23:37 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
olli commentedComment #3
sunMajor (at minimum).
Comment #4
chx commentedOh boy. PHP. I like #2 much better. Nowdoc is php 5.3.0 in case anyone wonders. Now i wonder, are we going to bump against the 2gb limit of a string? I'd guess not cos other backends store $cache->data too. I hope there are no more landmines buried in phpbackend...
Comment #5
Anonymous (not verified) commentednice find, glad to see we can remove the slashes crap.
Comment #6
olli commentedI think we need to do something with the $cid too, filed #2267649: Some cache keys do not work with PhpBackend.
Comment #7
dman commentedPretty sure this sort of rewriting is going to need tests. Flagging for a do-able Sprint task.
(I see one test - so that's a good base for novice to think up and add a few other ways to break things)
Comment #8
quietone commentedInstalled the patch and tested successfully. But get unexpected results when the input test string has three backslashes. The test passes but the display shows four backslashes, not the three expected.
Input:
$with_variable = array('foo' => '"three backslashes \\\"');
Test result:
Value array ( 'foo' => '"three backslashes \\\\"', ) is identical to value array ( 'foo' => '"three backslashes \\\\"', )
Comment #9
chx commented@quietone thanks for the report. Which patch did you test?
Comment #10
damien tournoud commentedI would like to see:
Which is the proper way of doing this.
But really, I would like to see this whole craziness go away. Storing cache entry in the opcode cache sounds like a terrible idea (even if I suggested it a long time ago). This is especially true because:
(1) The current implementation relies of the Opcode cache stating the file;
(2)
MTimeProtectedFileStoragetriggers at least an additionalstat()call anyway (to get the mtime of the containing directory)At this point (small file, with a stat() on it just done), loading the content of the file should be pretty cheap.
Comment #11
chx commentedComment #12
Anonymous (not verified) commentedre. #10:
- if serializing before var_export means we don't have to force callers of the API to implement extra methods on their data, then yay, that is cleaner.
- i agree on wanting to kill this backend entirely. the thinking behind it was roughly:
a) D8 is horribly slow
b) we need a faster cache system
c) we can't rely on APCu everywhere
removing this backend is primarily about convincing the maintainers that we can ship D8 without it.
Comment #13
damien tournoud commentedNo,
var_export()is just used to export of the serialized string into PHP code. That doesn't change anything functionally.Comment #14
olli commentedNice!! var_export() is also used in doctrine PhpFileCache.
Comment #15
Anonymous (not verified) commentedyes, and note that var_export put stupid constraints on the caller, which is why we avoided it in the first place.
Comment #16
olli commentedRe #8: That is because the test results use var_export which escapes the third backslash ('\\\"' equals '\\\\"').
Agree with #13, I don't think this changes anything compared to #0 or #2 - just less code.
Comment #17
damien tournoud commentedErm. We were not even quoting the string? :)
This whole thing was only working because:
(1) PHP casts unknown constants to strings and
(2) We just silence all errors when including the file.
Let's get this in and stop the bleeding...
Comment #18
damien tournoud commentedActually, bumping to critical because of the very real risk this opens up remote code execution possibilities.
Comment #19
Anonymous (not verified) commentedi agree with this RTBC, and the implementation is much simpler. yay.
#18 - can you explain what the remote code vulnerabilities are?
Comment #20
dries commentedCommitted to 8.x. Thanks!