[wp-trac] [WordPress Trac] #26665: Exception is thrown on line query.php on line 1758 Warning: strpos() expects parameter 1 to be string

WordPress Trac noreply at wordpress.org
Tue Dec 17 17:07:48 UTC 2013


#26665: Exception is thrown on line query.php on line 1758 Warning: strpos()
expects parameter 1 to be string
--------------------------+-----------------------------
 Reporter:  syntaxart     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.8
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 This exception is thrown when submitting a url such as
 !http://testing.dev/vacancy/?country[]=australia&country[]=new-zealand

 What is trying to be acheived?

 I am trying to submit multiple terms per taxonomy using a checkbox list of
 values with the name set to name="country[]".  The tax_query successfully
 works but an exception is printed to the window.

 I have created a fix on my local machine which is to wrap the nested
 statement with

 {{{

 if (!is_array($term)) {
                     if (strpos($term, '+') !== false) {
                         $terms = preg_split('/[+]+/', $term);
                         foreach ($terms as $term) {
                             $tax_query[] =
 array_merge($tax_query_defaults, array(
                                 'terms' => array($term)
                             ));
                         }
                     } else {
                         $tax_query[] = array_merge($tax_query_defaults,
 array(
                             'terms' => preg_split('/[,]+/', $term)
                         ));
                     }
                 }
 }}}

 I also used the plugin Taxonomy Picker to test multiple selected terms,
 and the same exception is thrown.

 Thank you very much for looking into this bug.

 Regards

 Ryan

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


More information about the wp-trac mailing list