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

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 11 01:51:12 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:                |
--------------------------+------------------------------

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'] );
 }
 }}}

--

Comment (by dd32):

 How can we re-create this warning? (I can't)

 Can you re-create ot with all plugins disabled and the default theme
 active?

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


More information about the wp-trac mailing list