[wp-trac] [WordPress Trac] #52253: New filter on wp-db.php

WordPress Trac noreply at wordpress.org
Fri Jan 8 06:10:08 UTC 2021


#52253: New filter on wp-db.php
-------------------------+------------------------------
 Reporter:  guelben      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Database     |     Version:  5.6
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by guelben):

 I think that the code should be instead:


 {{{
                         /**
                          * Filters the database returned row in a mysqli
 context.
                          *
                          * @since 5.6.1
                          * @param object $row Database fetched row.
                          * @param string $query Database query.
                          */
                         $row = apply_filters( 'returned_row_mysqli', $row,
 $query );
                         $this->last_result[ $num_rows ] = $row;

                         $num_rows++;
                 }
         } elseif ( is_resource( $this->result ) ) {
                 while ( $row = mysql_fetch_object( $this->result ) ) {

                         /**
                          * Filters the database returned row in a mysql
 context.
                          *
                          * @since 5.6.1
                          * @param object $row Database fetched row.
                          * @param string $query Database query.
                          */
                         $row = apply_filters( 'returned_row_mysql', $row,
 $query );
                         $this->last_result[ $num_rows ] = $row;
                         $num_rows++;
 }}}

 Here I place the lines:{{{ $this->last_result[ $num_rows ] = $row;}}}
 after the filters. But strangefully, the first code submitted worked nice,
 equally to the second one.

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


More information about the wp-trac mailing list