Make WordPress Core

Opened 10 months ago

#58662 new defect (bug)

Transients cannot contain non-ascii characters

Reported by: iarovuo's profile iarovuo Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.2.2
Component: Cache API Keywords:
Focuses: Cc:

Description

set_transient reference says:

  • Transient name is expected to not be SQL-escaped. Must be 172 characters or fewer in length.
  • Transient value must be serializable if non-scalar. Expected to not be SQL-escaped.

Making note of above, and trying to set transient value with plain text, but containing non-ascii characters, the function fails to save the transient.

Using simple preg_replace('/[A-Za-z0-9 ]/',, <text string> )); solves the problem, but the transient no longer contains the original text string.

As far as I see, serialization or json encoding the text string does not help, as it would still contain non-ascii characters.

So, either the set_transient function should accept more complex value parameters, or documentation should state the limitation on the value parameter.

I understand this may also be due to underlying memcached, but I do not see any mention in WP_Object_Cache documentation either that there are any limitations for the value/data to be stored.

Change History (0)

Note: See TracTickets for help on using tickets.