Skip to content

fix(pdf): attach the PDF font scripts to super-common so optimizers keep them in order - #263

Merged
RensTillmann merged 2 commits into
lts/6.3.xfrom
fix/lts-pdf-font-inline-script
Oct 20, 2026
Merged

RensTillmann merged 2 commits into
lts/6.3.xfrom
fix/lts-pdf-font-inline-script

Conversation

@RensTillmann

@RensTillmann RensTillmann commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Code part of #137 on 6.3 LTS. With PDF text rendering on, the plugin printed super_common_i18n.fonts = {NotoSans: ...} (Cyrillic, and Arabic when enabled) as raw <script> blocks on wp_footer (priority 100). If a JavaScript optimization plugin moves or delays the localized super_common_i18n, those scripts throw a ReferenceError and the PDF loses its non-Latin font.

Now a helper add_pdf_font_script() attaches them with wp_add_inline_script( super-common, ..., after ), in the same order (Arabic still overwrites Cyrillic); if super-common was already printed, it falls back to the old footer output. The JSON payload is unchanged.

Base branch

lts/6.3.x: bug fix for the stable channel. 6.4 counterpart: #261.

Tests

new tests/test-security-pdf-font-inline-script.php (named for the LTS harness, which runs test-security-*):
  without the fix: 2 of 3 fail
  with the fix:    OK (3 tests, 8 assertions); the third test guards the footer fallback
full LTS PHPUnit suite (g16-phpunit + MariaDB): OK, 667 tests (baseline lts/6.3.x: OK, 664 tests)
php -l includes/class-shortcodes.php: OK

Merge

Draft: for QA and the next LTS release session.

@RensTillmann
RensTillmann marked this pull request as ready for review October 20, 2026 15:50
@RensTillmann
RensTillmann merged commit a3ad218 into lts/6.3.x Oct 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant