id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 53023 _wp_json_convert_string type mismatch: returns string on success; false on failure hellofromTonya "The private function `_wp_json_convert_string` (which converts a string to UTF-8) also returns `false`, though its `@return` specifies only `string`. How? [https://www.php.net/manual/en/function.mb-convert-encoding.php `mb_convert_encoding`] returns a `string` on success and a `false` on failure. Is this a bug or docs fix? It's both. Reviewing its context, it's used by `_wp_json_sanity_check` to convert IDs and data value. The IDs are the problem. How so? Each ID is used as either a key or project for referencing the data value. What happens if the conversion to UTF-8 fails? The key or property would either be an empty string or `false`. That's problematic as it can cause unexpected JSON encoding results. For example, this [https://3v4l.org/n4qT6 3v4l snippet] simulates the convert encoding failure to view the results through the JSON encoding process. Notice how the returned JSON is invalid when it fails. (Note: This snippet is forcing a failure.)" defect (bug) new normal Awaiting Review Formatting 4.1.4 normal docs