Make WordPress Core

Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#5105 closed defect (bug) (duplicate)

Patch (formatting.php): notice-level error is being accidentally thrown

Reported by: richcon Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.3
Component: General Keywords:
Focuses: Cc:


The following line in formatting.php throws a notice-leve error (Uninitialized String Offset) if '$curl' is an empty string:

29: if (isset($curl{0}) && '<' != $curl{0} && $next) { If it's not a tag

Clearly, isset($curl{0}) is intended to prevent empty strings from being tested, but isset doesn't check string offsets.

Changing to the following prevents empty strings from being considered:

if ($curl && '<' != $curl{0} && $next) { If it's not a tag

Attachments (1)

formatting.php.diff (620 bytes) - added by richcon 8 years ago.

Download all attachments as: .zip

Change History (5)

#1 @foolswisdom
8 years ago

  • Keywords has-patch added
  • Milestone set to 2.4

8 years ago


#2 @darkdragon
8 years ago

Well, if you are checking to see if it is not empty, then you should use !empty().

if ( !empty($curl) && '<' != $curl{0} && $next ) { // If it isn't a tag

Should be used instead.

#3 @jacobsantos
7 years ago

  • Milestone 2.9 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #6669

#4 @jacobsantos
7 years ago

  • Keywords has-patch removed
Note: See TracTickets for help on using tickets.