Opened 2 years ago
Last modified 2 years ago
#15827 assigned defect (bug)
AJAX paging breaks badly when json_encode can't encode
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Administration | Version: | 3.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | westi, scribu |
Description
If json_encode can't encode a response for some reason you get no feedback at all except for a blank list.
This seems most likely to trigger with invalid UTF8 sequences in spam comments.
With non-ajax paging you at least get all the comments displayed even if you do get a lot of ??? for the bad chars
Example Error seen:
[15-Dec-2010 14:18:38] Warning: json_encode() [<a href='function.json-encode'>function.json-encode</a>]: Invalid UTF-8 sequence in argument in /home/wpdev/public_html/wp-admin/includes/class-wp-list-table.php on line 839 [
Attachments (1)
Change History (7)
SergeyBiryukov — 2 years ago
comment:3
SergeyBiryukov — 2 years ago
We can strip invalid characters with wp_check_invalid_utf8(). Patch included.
comment:4
SergeyBiryukov — 2 years ago
- Keywords has-patch added
- Cc scribu added
- Owner scribu deleted
- Status changed from new to assigned
comment:6
SergeyBiryukov — 2 years ago
Related: #11175
Note: See
TracTickets for help on using
tickets.

This is one reason I proposed a standard way of doing Ajax in #14618: it handles erroneous or syntactically invalid responses in a consistent manner.
In this case we could pass the href attribute value to the error handler and have it set location.href to load the requested page when Ajax paging fails.