[wp-trac] [WordPress Trac] #18063: When viewing category view an error is thrown

WordPress Trac wp-trac at lists.automattic.com
Sun Jul 10 18:24:45 UTC 2011


#18063: When viewing category view an error is thrown
--------------------------+------------------------------
 Reporter:  garyjob       |       Owner:  Gary Teh
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  3.1.4
 Severity:  trivial       |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Description changed by scribu:

Old description:

> This is the error
> -----------------------------------
> [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
>
> This is the proposed fix
> -----------------------------------
>
>                                 if(isset($query['terms'] )){
>                                         $term = get_term_by(
> $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
>                                 }
>                                 else{
>                                         $term = get_term_by(
> $query['field'], $query['terms'] , $query['taxonomy'] );
>                                 }

New description:

 This is the error
 -----------------------------------
 [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

 This is the proposed fix:

 {{{
                                 if(isset($query['terms'] )){
                                         $term = get_term_by(
 $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
                                 }
                                 else{
                                         $term = get_term_by(
 $query['field'], $query['terms'] , $query['taxonomy'] );
                                 }
 }}}

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18063#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list