WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#35864 closed defect (bug) (fixed)

Calling wptexturize() with trailing less-than symbol causes PHP warning

Reported by: westonruter Owned by: ocean90
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: Formatting Keywords: has-patch
Focuses: Cc:

Description

Calling wptexturize( 'foo< ) causes a PHP warning:

Uninitialized string offset: 1

The issue lies in the _wptexturize_pushpop_element function which is not checking if an array item is set. It needs this change:

- if ( '/' !== $text[1] ) {
+ if ( isset( $text[1] ) && '/' !== $text[1] ) {

Discovered while testing #27355.

Attachments (1)

35864.0.diff (1.3 KB) - added by westonruter 5 years ago.

Download all attachments as: .zip

Change History (3)

@westonruter
5 years ago

#1 @westonruter
5 years ago

  • Keywords has-patch added

#2 @ocean90
5 years ago

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

In 36578:

Formatting: Avoid a PHP warning when wptexturize() is called with a trailing less-than symbol.

Props westonruter.
Fixes #35864.

Note: See TracTickets for help on using tickets.