#9244 closed defect (bug) (fixed)
Hyphen in Theme Directory Breaks Theme Preview
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.8 |
| Component: | Themes | Version: | 2.8 |
| Severity: | trivial | Keywords: | theme, preview, has-patch |
| Cc: | chrisbliss18 |
Description
There is a bug in the regex expressions in the preview_theme() function. The hyphen is not escaped, so themes that have hyphens in the directory name cause the function to return rather than continue. Thus, when previewing a theme with a hypen in the directory, all that is rendered is a white page.
The attached diff corrects this issue when scrubbing both the template and the stylesheet.
Attachments (2)
Change History (12)
chrisbliss18 — 4 years ago
comment:1
chrisbliss18 — 4 years ago
- Status changed from new to assigned
comment:2
chrisbliss18 — 4 years ago
- Keywords has-patch added
- Resolution set to fixed
- Status changed from assigned to closed
Dup of #8548
comment:5
automattor — 4 years ago
comment:6
jacobsantos — 4 years ago
- Milestone changed from Unassigned to 2.8
- Resolution fixed deleted
- Severity changed from normal to trivial
- Status changed from closed to reopened
This is probably overly punctilious, but the backslash is unnecessary and its intended purpose might seem unclear to people in the future. Patch attached.
- Resolution set to fixed
- Status changed from reopened to closed
comment:9
follow-up:
↓ 10
chrisbliss18 — 4 years ago
Just to play devil's advocate here, I'm not sure how putting the hyphen at the end again is less confusing. It simply adds the potential of reintroducing this bug if someone adds yet another character at the end of the character class.
comment:10
in reply to:
↑ 9
filosofo — 4 years ago
Replying to chrisbliss18:
Just to play devil's advocate here, I'm not sure how putting the hyphen at the end again is less confusing. It simply adds the potential of reintroducing this bug if someone adds yet another character at the end of the character class.
A mere backslash won't prevent all the potential damage to a regex done by someone who modifies it without understanding.
Moving the hyphen to the beginning or the end of the character class makes its purpose unambiguous to a knowledgeable person, and it eliminates an excess character.
And now I must return to trimming my lawn with a nail clipper.

See: #8548 (reopened defect (bug)): Theme preview fails when theme in subdirectory
(Might be best to close as duplicate and add patch over there?)