Jump to content

Unable to encode array data for cache..


Can
 Share

Recommended Posts

Hey folks,

just got an "Unable to encode array data for cache.." error from WireCache.

Had an ´ (acute accent) in a page title, after changing to ' (single quote)  everything worked again.

I have to say, that the acute accent didn't looked good anyway, got this weird black thing^^

The only thing I tried so far, was changing line 318 of WireCache.php to

$data = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); 

couldn't recognize any difference..

So am I better off changing those (don't know if there are more..) or what else can I do?

Link to comment
Share on other sites

You could escape the values with 'htmlentities' — either manually or automatically via custom TextFormatter.

---

Edit: Or it's possibly something else; I've just $cache->saved an array with string with acute in it and had no problems. 

  • Like 1
Link to comment
Share on other sites

Right, haha, that's why I waited with posting this question. Just forgot about additional thought I head...anyway after trying text formatter which didn't made the trick I narrowed it down to a custom character limiting function in my template.

After trying around I got it working by changing substr() to mb_substr() =)

Thanks Adam! :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...