[wp-trac] [WordPress Trac] #31149: Error Object of class stdClass could not be converted to int in ms-functions.php on line 1788

WordPress Trac noreply at wordpress.org
Fri Jan 30 12:41:20 UTC 2015


#31149: Error Object of class stdClass could not be converted to int in ms-
functions.php on line 1788
----------------------------------------+------------------------
 Reporter:  hauvong                     |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  4.2
Component:  Taxonomy                    |     Version:  3.0
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:  multisite
----------------------------------------+------------------------
Changes (by SergeyBiryukov):

 * keywords:   => has-patch needs-unit-tests
 * version:  trunk => 3.0
 * milestone:  Awaiting Review => 4.2


Old description:

> Issue cause by $wpdb->get_row return object to $local_id but was pass to
> global_terms to use as int.  Fix by switching to $wpdb->get_var:
>
> Change from:
> $local_id = $wpdb->get_row( $wpdb->prepare( "SELECT term_id FROM
> $wpdb->terms WHERE term_id = %d", $global_id ) );
>
> To correction:
> $local_id = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM
> $wpdb->terms WHERE term_id = %d", $global_id ) );

New description:

 Issue cause by `$wpdb->get_row()` return object to `$local_id` but was
 pass to global_terms to use as int.  Fix by switching to
 `$wpdb->get_var()`:

 Change from:
 {{{
 $local_id = $wpdb->get_row( $wpdb->prepare( "SELECT term_id FROM
 $wpdb->terms WHERE term_id = %d", $global_id ) );
 }}}

 To correction:
 {{{
 $local_id = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM
 $wpdb->terms WHERE term_id = %d", $global_id ) );
 }}}

--

Comment:

 Introduced in [13925].

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31149#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list