WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#26467 closed defect (bug) (fixed)

Twenty Fourteen: Errant \ in page.php

Reported by: Ipstenu Owned by: nacin
Milestone: 3.8 Priority: normal
Severity: normal Version: 3.8
Component: Bundled Theme Keywords: has-patch commit
Focuses: Cc:

Description

From the forums: http://wordpress.org/support/topic/warning-unexpected-character-in-input-ascii92-state1

Warning: Unexpected character in input: '\' (ASCII=92) state=1

There is clearly a backslash ("\") just before the colon of the if statement on line 19.

And lo there is: http://core.trac.wordpress.org/browser/trunk/src/wp-content/themes/twentyfourteen/page.php#L19

Patch attached.

Attachments (3)

26467.diff (545 bytes) - added by Ipstenu 6 years ago.
Removing stray /
26467.1.diff (1.1 KB) - added by Ipstenu 6 years ago.
Using brackets instead
26467.2.diff (1.6 KB) - added by lancewillett 6 years ago.

Download all attachments as: .zip

Change History (13)

@Ipstenu
6 years ago

Removing stray /

#1 @Ipstenu
6 years ago

  • Summary changed from Errant \ in to [TwentyFourteen] Errant \ in page.php

#2 @ocean90
6 years ago

  • Component changed from Themes to Bundled Theme
  • Keywords has-patch commit added
  • Milestone changed from Awaiting Review to 3.8
  • Summary changed from [TwentyFourteen] Errant \ in page.php to Twenty Fourteen: Errant \ in page.php

#3 @nacin
6 years ago

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

In 26757:

Twenty Fourteen: Remove stray slash.

props Ipstenu.
fixes #26467.

@Ipstenu
6 years ago

Using brackets instead

#4 @Ipstenu
6 years ago

Actually looking at this more, it looks like the last revision reverted the change to brackets.

I attached a second diff with Drew's inline remarks and keeping brackets :(

#5 @Ipstenu
6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening since the other diff may need to be used instead with brackets (per Ocean90). Sorry, missed this the first time, and only notice when I stepped back to see when this broke.

#6 @lancewillett
6 years ago

I'd prefer not to change to braces, here. Thanks for the errant / catch, though!

#7 @obenland
6 years ago

Yes, I think we agreed with sticking to the more verbose syntax in templates.

#9 @nacin
6 years ago

Generally speaking, we use braces whenever we remain entirely within PHP, and alternative style when we're breaking in and out of PHP. It seems in this case moving to braces makes sense. In themes, it is additionally always used for the loop, and the while is usually on the same line as the_post(). For two-line if statements, there's basically no reason to use alternative style.

There's not a lot of consistency when looking through the default themes, in terms of alternative style in templates. In Twenty Fourteen, about a third of if statements in templates use braces, a third use alternative syntax then immediately break out of PHP (proper), and another third use alternative syntax then stay in PHP (ideally not used).

@lancewillett
6 years ago

#10 @lancewillett
6 years ago

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

In 26761:

Twenty Fourteen: clean up PHP braces style in page templates. Closes #26467.

Note: See TracTickets for help on using tickets.