[wp-trac] [WordPress Trac] #43116: wp_footer actions being applied to output when the Content-Type header is set to "application/pdf"
WordPress Trac
noreply at wordpress.org
Wed Jan 17 20:05:11 UTC 2018
#43116: wp_footer actions being applied to output when the Content-Type header is
set to "application/pdf"
--------------------------+-----------------------------
Reporter: jdgregson | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.9.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
We encountered an issue trying to download some PDFs through index.php
using Gravity Forms. I believe this issue should be fixed in WordPress
Core rather than the Gravity Forms plugin.
When a PDF downloaded through index.php contains a </body> tag (which is
valid inside [https://en.wikipedia.org/wiki/XFA XFA] forms in the PDF),
WordPress sees the tag and inserts the code which was added to the
wp_footer hook, completely breaking the PDF.
I have downloaded the PDF using wget and can see that the "Content-Type"
header is set to "application/pdf".
I suggest that the wp_footer hook (and probably all hooks) check to see if
the Content-Type is something other than the default "text/html" and avoid
executing if so.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43116>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list