Opened 11 years ago
Closed 11 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)
Change History (13)
#2
@
11 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
@
11 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In 26757:
#4
@
11 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
@
11 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.
#9
@
11 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).
Removing stray /