WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#7653 closed defect (bug) (fixed)

Count in wp_sprintf_l() is used, but not defined.

Reported by: jacobsantos Owned by:
Milestone: 2.7 Priority: low
Severity: minor Version: 2.7
Component: General Keywords: has-patch tested commit
Focuses: Cc:

Description

The function checks for the $i variable, which I assume is supposed to be from the count, but is never defined. The condition that uses that variable will always be false all cases. Patch defines the variable, which is hopefully what the developer had in mind.

The note about being greater than 2 items is not checked for and is another bug, I suspect. I suppose the intention is to have the remaining item appended after and break out of the loop, however the only check is a boolean, which is not suffice of a check to ensure this.

Attachments (2)

7653.r8781.diff (591 bytes) - added by jacobsantos 6 years ago.
defines variable based off of r8781.
7653.diff (540 bytes) - added by ryan 6 years ago.
Don't count in loop

Download all attachments as: .zip

Change History (6)

jacobsantos6 years ago

defines variable based off of r8781.

ryan6 years ago

Don't count in loop

comment:1 ryan6 years ago

Patch pulls count out of the loop. That function is rather odd.

comment:2 jacobsantos6 years ago

  • Keywords tested commit added; needs-testing removed

Your patch works for me.

comment:3 jacobsantos6 years ago

Except that it could be that the $i-- belongs at the end. I'll say, an offset mistake is better than a complete malfunction, since it would be an easy change to fix later.

comment:4 westi6 years ago

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

(In [9189]) Notice fix and don't count inside a loop. Fixes #7653 props ryan.

Note: See TracTickets for help on using tickets.