#37028 closed defect (bug) (maybelater)
Taxonomy terms array to string conversion in class-wp-ajax-response.php
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.5.2 |
Component: | Taxonomy | Keywords: | |
Focuses: | Cc: |
Description
When adding or deleting single term on custom taxonomy page will always return PHP Notice: Array to string conversion in \wp-includes\class-wp-ajax-response.php on line 119
<?php if ( is_array( $r['supplemental'] ) ) { foreach ( $r['supplemental'] as $k => $v ) { $s .= "<$k><![CDATA[$v]]></$k>"; } $s = "<supplemental>$s</supplemental>"; }
The issue exist even on freshly installed WP with or without any plugins, But does not exist on bulk deleting.
Change History (4)
#2
@
5 years ago
I am sorry, but I found what cause this issue.
One of my theme's included php file contained one space character after close php tag
?> <- one space here
I didn't mentioned WP does not trim content, and it is miracle that I could find this lone space. In other cases, find a such mistake would be impossible. 'WP_DEBUG' and 'WP_DEBUG_LOG' couldn't catch this.
Update: the problem still exist. The promlem appears on any term (category, tags or custom taxonomy) when adding tag or term. I am trying to find what cause this. Will keep you update.
#3
@
5 years ago
- Resolution set to maybelater
- Status changed from new to closed
I have found what cause debug loggin.
The problem was in qtranslate plugin.
https://github.com/qTranslate-Team/qtranslate-x/releases/tag/3.4.6.9
Will send report to plugin developer.
Thanks for concern!
Hi @esemlabel - Can you please provide more details? I can't reproduce, and I'm unsure how this would happen on a default installation of WordPress.
Here's what I tried:
wp-admin/edit-tags.php?taxonomy=foo
Is this what you're doing?
The AJAX handler that WP uses when deleting a term in this way doesn't even create a
WP_AJAX_Response
object, so I'm unsure how deleting would cause the notice you've described. https://core.trac.wordpress.org/browser/tags/4.5.2/src/wp-admin/includes/ajax-actions.php#L579'supplemental' data is added when you successfully create a term. The two types of 'supplemental' data https://core.trac.wordpress.org/browser/tags/4.5.2/src/wp-admin/includes/ajax-actions.php?marks=861,866#L819:
array( 'noparents' => $noparents, 'parents' => $parents )
, where$noparents
and$parents
are strings (markup for a row of the list table).WP_Term
object, cast to array.It's not clear to me how either one of these would end up with a nested array.
If you can provide more debugging info - in particular, the value of 'supplemental' that's causing the problem - it would be helpful. You can get this info by looking at the response sent by the AJAX request, using your browser's Network inspector.