[wp-trac] [WordPress Trac] #21967: WordPress Bug - PHP Warning Message "Passed variable is not an array or object"

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 22 16:47:12 UTC 2012


#21967: WordPress Bug - PHP Warning Message  "Passed variable is not an array or
object"
----------------------------------------+--------------------------
 Reporter:  onetarek                    |       Type:  defect (bug)
   Status:  new                         |   Priority:  normal
Milestone:  Awaiting Review             |  Component:  Query
  Version:  3.4.2                       |   Severity:  major
 Keywords:  needs-testing dev-feedback  |
----------------------------------------+--------------------------
 Today I found following warning message by wordpress/PHP [[BR]]


 {{{
 [22-Sep-2012 11:00:16] PHP Warning:  reset() [<a
 href='function.reset'>function.reset</a>]: Passed variable is not an array
 or object in /home/..../public_html/wp-includes/query.php on line 2971
 }}}
  [[BR]]

 This warning is not occurred for every page visit/query. But it is huge in
 my error_log.
 I opened wp-includes/query.php on line 2971 and found this line '''
 {{{
 $term = get_term_by( $query['field'], reset( $query['terms'] ),
 $query['taxonomy'] );
 }}}
 ''' [[BR]]
 in some case this variable
 {{{
 $query['terms']
 }}}
  is not an object/array.
 Now wordpress should check whether this var is an object/array or not
 before reset() that.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21967>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list