Skip to content

Improved post element ordering - #4597

Open
girishpanchal30 wants to merge 4 commits into
developmentfrom
bugfix/4593
Open

Improved post element ordering#4597
girishpanchal30 wants to merge 4 commits into
developmentfrom
bugfix/4593

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

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

@pirate-bot

pirate-bot commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Plugin build for 68e72ff is ready 🛎️!

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.

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.

Comment thread tests/test-neve-ordering.php Outdated
Comment thread tests/test-neve-ordering.php Outdated
Comment thread tests/test-neve-ordering.php

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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Comment thread tests/test-neve-ordering.php Outdated
Comment thread tests/test-neve-ordering.php Outdated
Comment thread tests/test-neve-ordering.php Outdated
Comment thread inc/customizer/options/layout_single_post.php Outdated

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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Comment thread tests/test-neve-ordering.php Outdated
Comment thread tests/test-neve-ordering.php Outdated
Comment thread tests/test-neve-ordering.php Outdated
Comment thread inc/views/post_layout.php
Comment thread tests/test-neve-ordering.php Outdated
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.

Customizer crashes when single-post element order is stored as an array

4 participants