Opened 6 years ago
Closed 5 years ago
#46863 closed defect (bug) (fixed)
site title doesn't properly escape '{{ }}'
Reported by: | OddenCreative | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.3 | Priority: | normal |
Severity: | major | Version: | 5.1 |
Component: | Customize | Keywords: | has-patch |
Focuses: | Cc: |
Description
I put in {{ do | io }} for a site title and after publishing and leaving the customizer, came back to it. All of the functionality aside from the widgets was missing. After sometime I realized I probably created the issue with the site title, removed {{ }} from {{ do | io }} and all the customizer actions returned.
Attachments (3)
Change History (15)
#2
in reply to:
↑ 1
@
6 years ago
I'm able to replicate this on WP 5.2
Replying to OddenCreative:
I am going to try to find time to fix this, though I have just started a new job.
#3
@
5 years ago
The issue in your case is specifically in this line of code.
<span class="browser-title" aria-hidden="true"><?php bloginfo( 'name' ); ?></span>
Since that line is inside an underscore template, {{ }}
is treated as special characters. So basically setting your site name as {{ [ anything ] }}
will make the underscore script treat is as data to be compiled / rendered.
I haven't made any patch as I'm not sure how to proceed here. I can think of a few solution.
1.] Change the interpolate from {{ }}
to other style / character.
2.] Since the usage of the line above is for aria. Maybe it's plausible to strip {{ }}
in the bloginfo( 'name' );
?
3.] Make underscore treat <?php bloginfo( 'name' ); ?>
as string literal and prevent it from being processed. This might be the best solution but I tried to research and read the underscore's docs but I can't seem to find a way to do this. Maybe i'm missing something.
This ticket was mentioned in Slack in #core by donmhico. View the logs.
5 years ago
#7
@
5 years ago
Patch print-site-name.2.patch of @pierlo works, thanks man.
In my new patch, 46863.diff, I removed the the trailing space inside print()
and I also applied the same fix on wp_print_media_templates()
.
This ticket was mentioned in Slack in #core by pierlo. View the logs.
5 years ago
#10
@
5 years ago
- Milestone changed from Awaiting Review to 5.3
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
I am going to try to find time to fix this, though I have just started a new job.