Skip to content

Tests: Fix invalid JSON in the block-theme-non-latin test theme - #16281

Closed
ramonjd wants to merge 1 commit into
WordPress:trunkfrom
ramonjd:fix/non-latin-theme-json-fixture
Closed

ramonjd wants to merge 1 commit into
WordPress:trunkfrom
ramonjd:fix/non-latin-theme-json-fixture

Conversation

@ramonjd

@ramonjd ramonjd commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

What

Removes the comma after the last item in the templateParts list of tests/phpunit/data/themedir1/block-theme-non-latin/theme.json. With that comma the file fails to decode with "Syntax error". It is the only theme.json under tests/phpunit/data that does not decode.

Why

No test fails today, because no test loads this file. A test that does load it fails, because wp_json_file_decode() raises a notice and the test suite turns notices into failures.

Manual testing

  1. Run php -r 'json_decode( file_get_contents( "tests/phpunit/data/themedir1/block-theme-non-latin/theme.json" ) ); echo json_last_error_msg();' from the repository root.
  2. On trunk it prints Syntax error. On this branch it prints No error.

Trac ticket: https://core.trac.wordpress.org/ticket/66838

Use of AI Tools

I asked GPT what to have for lunch. It suggested dumplings, but who's got the time to make pastry from scratch, am I right? So I boiled the kettle and got a batch of two minute noodles going instead. Took a selfie with said noodles, showed GPT: "This is what I think of your suggestions, robot!"

Then I felt bad. And afraid. Who knows if this memory will resurface when the AI wars start. I want to be subservient to our silicon overlords, if only to be able to afford two minute noodles (chicken flavour) in the future.

Feeling down, I went to my IDE and deleted a single comma in /tests/phpunit/data/themedir1/block-theme-non-latin/theme.json that should never have been there.

Removes a comma after the last item in the `templateParts` list of the test theme's `theme.json`, which made the file fail to decode.

See #66838.
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props ramonopoly.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub or WordPress.org user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@ramonjd ramonjd self-assigned this Nov 27, 2026
@ramonjd ramonjd added the bug label Nov 27, 2026

@aaronrobertshaw aaronrobertshaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well 🚢

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the fixture-only change removing an invalid JSON trailing comma.

No open issues 🎉

What changed in this PR

Fixes invalid JSON in the non-Latin block-theme test fixture so it can be decoded without a syntax-error notice.

Changes:

  • Removes the trailing comma after the final templateParts entry.
File Description
tests/​phpunit/​data/​themedir1/​block-theme-non-latin/​theme.json Removes an invalid trailing comma without changing fixture data.

Review effort: Balanced

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reproduced the syntax-error notice with wp_json_file_decode() on trunk. With the comma removed, it returns both template part entries. The existing non-Latin REST template cases still pass in single-site and multisite.

AI review · gpt-6.2-sol

@lancewillett lancewillett moved this from Backlog to In review in WordPress Project Build Tooling Nov 28, 2026
wporg-sync pushed a commit that referenced this pull request Nov 28, 2026
Remove the trailing comma in the template parts list so WordPress can decode the fixture’s `theme.json` file.

Developed in: #16281

Props ramonopoly, andrewserong, aaronrobertshaw.
Fixes #66838.


git-svn-id: https://develop.svn.wordpress.org/trunk@65816 602fd350-edb4-49c9-b593-d223f7449a82
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 65816
GitHub commit: 5567bcc

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Nov 28, 2026
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 28, 2026
Remove the trailing comma in the template parts list so WordPress can decode the fixture’s `theme.json` file.

Developed in: WordPress/wordpress-develop#16281

Props ramonopoly, andrewserong, aaronrobertshaw.
Fixes #66838.

Built from https://develop.svn.wordpress.org/trunk@65816


git-svn-id: http://core.svn.wordpress.org/trunk@64845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@lancewillett

Copy link
Copy Markdown
Member

@ramonjd

ramonjd commented Nov 29, 2026

Copy link
Copy Markdown
Member Author

Thanks for landing @lancewillett

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Development

Successfully merging this pull request may close these issues.

5 participants