Skip to content

fix: preserve exporter incomplete objects#1423

Merged
superdav42 merged 1 commit into
mainfrom
fix/checkout-exporter-incomplete-object
Jun 13, 2026
Merged

fix: preserve exporter incomplete objects#1423
superdav42 merged 1 commit into
mainfrom
fix/checkout-exporter-incomplete-object

Conversation

@superdav42

@superdav42 superdav42 commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve __PHP_Incomplete_Class values in the site exporter database search/replace path before object property mutation.
  • Add a regression covering serialized payloads that contain an incomplete object plus replaceable URL data.

Verification

  • php -l inc/site-exporter/database/class-replace.php
  • php -l tests/WP_Ultimo/Site_Exporter_Test.php
  • vendor/bin/phpcs inc/site-exporter/database/class-replace.php tests/WP_Ultimo/Site_Exporter_Test.php
  • git diff --check
  • Standalone exporter probe: warnings=0 old=yes new=yes

Not Run

  • vendor/bin/phpunit --filter test_recursive_unserialize_replace_preserves_incomplete_objects is blocked locally because /tmp/wordpress-tests-lib/includes/functions.php is missing.

aidevops.sh v3.20.58 plugin for OpenCode v1.17.4 with gpt-5.5

Summary by CodeRabbit

  • Bug Fixes

    • Fixed handling of certain serialized data formats during database export operations to prevent processing errors.
  • Tests

    • Added regression test to ensure proper handling of edge-case serialized data during export operations.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2cd1a5c5-3a2f-49e2-934d-c12ee833f461

📥 Commits

Reviewing files that changed from the base of the PR and between 6c1bfdb and 343fd4e.

📒 Files selected for processing (2)
  • inc/site-exporter/database/class-replace.php
  • tests/WP_Ultimo/Site_Exporter_Test.php

📝 Walkthrough

Walkthrough

This PR adds a guard clause to Replace::recursive_unserialize_replace() that detects and returns \__PHP_Incomplete_Class instances unchanged, preventing further recursion. A regression test verifies the behavior generates no warnings and preserves both old and replaced URLs in the serialized output.

Changes

Incomplete object handling

Layer / File(s) Summary
Incomplete object guard and regression test
inc/site-exporter/database/class-replace.php, tests/WP_Ultimo/Site_Exporter_Test.php
recursive_unserialize_replace() checks for __PHP_Incomplete_Class and returns it unchanged to prevent warnings. Regression test constructs an incomplete serialized object, installs an error handler, invokes the method via reflection, and asserts zero warnings plus both old and replaced URLs in the result.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Ultimate-Multisite/ultimate-multisite#1419: Both PRs add explicit handling to detect __PHP_Incomplete_Class during unserialize/recursive URL replacement and return/preserve those incomplete objects unchanged (in recursive_unserialize_replace() vs MUCD_Data::try_replace()), so the logic and regression coverage are directly aligned.

Suggested labels

origin:interactive

Poem

A rabbit hops through serialize deep,
And finds odd objects incomplete to keep—
No warnings now, just pass them by,
With URLs replaced, the site won't cry! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: preserve exporter incomplete objects' accurately and concisely describes the main change: adding a fix to preserve __PHP_Incomplete_Class instances in the site exporter database search/replace path.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/checkout-exporter-incomplete-object

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42 superdav42 merged commit dc5a204 into main Jun 13, 2026
12 checks passed
@superdav42 superdav42 deleted the fix/checkout-exporter-incomplete-object branch June 13, 2026 17:40
@superdav42 superdav42 added the review-feedback-scanned Merged PR already scanned for quality feedback label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-feedback-scanned Merged PR already scanned for quality feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant