Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
At the moment caching is only serialized for arrays and objects. There for the dataype e.g. 'integer' and 'double' are lost when retrieving a variable.
This fix sets all datatypes that are not a string serialized so this data is preserved.
Tests for this bug are provided here:
http://drupal.org/node/276267
Comment | File | Size | Author |
---|---|---|---|
fix_cache_datatype.patch | 616 bytes | R.Muilwijk | |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedWell. PHP is a loosely typed language, after all, so I can't see how this could be a problem. At least, that's not critical.
However, the patch looks good and promote consistency, so marking as RTBC.
Comment #2
Dries CreditAttribution: Dries commentedPlease write some tests for this. It is important when people write an alternative cache backend. They could re-use these tests. Thanks!
Comment #3
R.Muilwijk CreditAttribution: R.Muilwijk commented@Dries, as said in the topic the tests are already written on: http://drupal.org/node/276267
Comment #4
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Good catch.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedIs it possible that cache_set could be storing a resource id? If so then we need to also filter !is_resource($data) because you cannot serialize a resource. Actually, I'm not sure we shouldn't also serialize the strings. So I think we should instead do
Comment #6
cwgordon7 CreditAttribution: cwgordon7 commentedLet the resources get serialized.
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedFrom http://us2.php.net/manual/en/function.serialize.php we see
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.