WordPress.org

Make WordPress Core

#25895 closed defect (bug) (fixed)

get_search_stopwords : undefined var

Reported by: tivnet Owned by: SergeyBiryukov
Milestone: 3.8 Priority: normal
Severity: normal Version: 3.7
Component: Query Keywords: has-patch commit
Focuses: Cc:

Description

If translators decide to have an empty list of stopwords, there will be an undefined variable warning, because $stopwords was not initialized before the loop

Added $stopwords = array(); before the loop.

Attachments (1)

get_search_stopwords--undefined-var.patch (620 bytes) - added by tivnet 21 months ago.

Download all attachments as: .zip

Change History (9)

comment:1 @SergeyBiryukov21 months ago

  • Milestone changed from Awaiting Review to 3.7.2
  • Version changed from 3.7.1 to 3.7

comment:2 @SergeyBiryukov21 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 26060:

Declare the variable before using it. props tivnet. fixes #25895 for trunk.

comment:3 @SergeyBiryukov21 months ago

  • Keywords commit fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:4 @dd3221 months ago

I don't personally think a PHP Notice warrants a point release.

comment:5 follow-up: @nacin21 months ago

I think this would actually end up being an E_WARNING, due to in_array() not receiving an array.

comment:6 in reply to: ↑ 5 @SergeyBiryukov21 months ago

Replying to nacin:

I think this would actually end up being an E_WARNING, due to in_array() not receiving an array.

Correct:

Notice: Undefined variable: stopwords in wp-includes/query.php on line 2033
Warning: in_array() [function.in-array]: Wrong datatype for second argument in wp-includes/query.php on line 1993

comment:7 @nacin19 months ago

  • Component changed from General to Query

comment:8 @nacin16 months ago

  • Keywords fixed-major removed
  • Milestone changed from 3.7.2 to 3.8
  • Resolution set to fixed
  • Status changed from reopened to closed

Moving to 3.8 and calling this fixed.

Note: See TracTickets for help on using tickets.