Opened 3 years ago
#58662 new defect (bug)
Transients cannot contain non-ascii characters
| Reported by: | iarovuo | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Cache API | Version: | 6.2.2 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)