Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 8 years ago

#26665 closed defect (bug) (duplicate)

Exception is thrown on line query.php on line 1758 Warning: strpos() expects parameter 1 to be string

Reported by: syntaxart Owned by:
Priority: normal Milestone:
Component: Query Version: 3.8
Severity: normal Keywords:
Cc: Focuses:

Description

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

Change History (1)

#1 @SergeyBiryukov
13 years ago

  • Component General → Query
  • Milestone Awaiting Review
  • Resolution → duplicate
  • Status new → closed

Duplicate of and #26308 and #17737.

Version 0, edited 13 years ago by SergeyBiryukov (next)
Note: See TracTickets for help on using tickets.