WordPress.org

Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #18063


Ignore:
Timestamp:
07/11/2011 01:51:11 AM (8 years ago)
Author:
dd32
Comment:

How can we reproduce this warning? (I can't)

Can you reproduce it with all plugins disabled and the default theme active?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #18063 – Description

    v1 v2  
    11This is the error
    22-----------------------------------
    3 [Mon Jul 11 00:04:56 2011] [error] [client 127.0.0.1] PHP Warning:  reset() [<a href='function.reset'>function.reset</a>]: Passed variable is not an array or object in C:\\applications\\nubee\\htdocs\\wp-includes\\query.php on line 2891, referer: http://wordpress_site/?category_name=game-zh-hans&lang=zh-hans&lang=zh-hans
     3`[Mon Jul 11 00:04:56 2011] [error] [client 127.0.0.1] PHP Warning:  reset() [<a href='function.reset'>function.reset</a>]: Passed variable is not an array or object in C:\\applications\\nubee\\htdocs\\wp-includes\\query.php on line 2891, referer: http://wordpress_site/?category_name=game-zh-hans&lang=zh-hans&lang=zh-hans`
    44
    55This is the proposed fix:
    66
    77{{{
    8                                 if(isset($query['terms'] )){
    9                                         $term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
    10                                 }
    11                                 else{
    12                                         $term = get_term_by( $query['field'], $query['terms'] , $query['taxonomy'] );                           
    13                                 }
     8if(isset($query['terms'] )){
     9        $term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
     10}
     11else{
     12        $term = get_term_by( $query['field'], $query['terms'] , $query['taxonomy'] );                           
     13}
    1414}}}