Improved post element ordering - #4597
Open
girishpanchal30 wants to merge 4 commits into
Open
Conversation
Collaborator
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR hardens Neve’s ordering-related theme-mod and meta parsing against non-string inputs (arrays/invalid JSON) to prevent PHP 8 json_decode() TypeErrors, and consolidates/expands unit tests to cover both blog and single-post ordering.
Changes:
- Added broader unit tests covering blog ordering, single post ordering, Customizer sanitize callbacks, and metabox overrides across multiple input shapes (JSON strings, arrays, invalid values).
- Updated multiple code paths to only
json_decode()strings and to fall back safely when decoded values aren’t arrays. - Extended WooCommerce test stubs with missing conditionals/helpers used by code paths now reached in tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test-neve-ordering.php | New consolidated tests for blog + single post ordering guards and sanitizers. |
| tests/test-neve-content-ordering.php | Removes older, narrower blog-only ordering test file (replaced by consolidated suite). |
| tests/stubs/woocommerce-cart.php | Adds is_shop() and wc_get_page_id() stubs for test execution paths. |
| inc/views/post_layout.php | Safely decodes single post ordering mod only when it’s a string; falls back on invalid shapes. |
| inc/views/pluggable/metabox_settings.php | Makes metabox elements order tolerant of array/broken meta by decoding conditionally and falling back. |
| inc/customizer/options/layout_single_post.php | Makes active callback + sanitize resilient to array/invalid inputs; normalizes output to JSON lists. |
| inc/customizer/options/layout_blog.php | Prevents fatal in masonry logic by decoding only strings and requiring an array shape. |
| inc/customizer/controls/ordering.php | Prevents fatal in control rendering by decoding only strings. |
| inc/admin/metabox/manager.php | Makes default-order derivation tolerant of array/invalid theme-mod shapes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
girishpanchal30
force-pushed
the
bugfix/4593
branch
from
August 24, 2026 09:58
0f5c350 to
212d6f7
Compare
Copilot stopped reviewing on behalf of
girishpanchal30 due to an error
August 24, 2026 10:11
Soare-Robert-Daniel
approved these changes
Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Checked the post elements ordering; if it is JSON text, then decode it correctly to prevent a TypeError.
Check before Pull Request is ready:
Closes #4593