Skip to content

Fix the throws report for the failing lazy ghost fixture - #92

Merged
veewee merged 1 commit into
mainfrom
fix-throws-xdebug-address-reuse
Nov 20, 2026
Merged

veewee merged 1 commit into
mainfrom
fix-throws-xdebug-address-reuse

Conversation

@veewee

@veewee veewee commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

The Throws workflow fails on main since #91. It credits one of the four throws from the failing lazy ghost to property_is_initialized() at ObjectEncoder.php:90, while allowed-throws.php expects all four via Lens->get.

CI is right. Xdebug 3.5.3 caches an exception's stack by object address and keeps that entry after the exception is freed. Both catch sites drop the exception immediately, so the next one can land on the same address and get printed with the old stack. On the runner that passed in October (ubuntu-24.04, PHP 8.4.26) and on a local Debian image the address gets reused. On ubuntu-26.04 with PHP 8.4.28 it does not.

The fixture now keeps every exception it throws alive, so the attribution no longer depends on the allocator, and the allowlist lists 3 throws via Lens->get and 1 via property_is_initialized().

The same Xdebug behaviour can misattribute other throws whose exception reuses a freed address. Totals stay right, and I found no way to turn the cache off from userland.

Summary by CodeRabbit

  • Tests
    • Updated test coverage for how encoding handles lazy-object initializer exceptions and checks whether a null-valued property is present.

Xdebug 3.5.3 caches the stack of each exception by object address and does
not clear it when the exception is freed. A later exception allocated at the
same address is then reported with the earlier stack. Whether the address is
reused depends on the allocator, so local runs credited all four throws of the
failing lazy ghost to Lens->get, while CI credits one of them, correctly, to
property_is_initialized().

The fixture now keeps every exception it throws, so no two share an address,
and the allowlist lists the real call sites.
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The lazy-object test records and throws its initializer exception. The throws allowlist separates exceptions attributed to Lens->get from the exception attributed to property_is_initialized.

Changes: Lazy-object exception accounting

Layer / File(s) Summary
Test exception capture and allowlist
tests/Unit/Encoder/ObjectPropertyPresenceTest.php, tests/Support/Throws/allowed-throws.php
The test records the initializer’s RuntimeException before throwing it. The allowlist assigns three exceptions to Lens->get and one to property_is_initialized.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Possibly related PRs

  • php-soap/encoding#79: Both PRs involve property_is_initialized() and property-presence checks.
  • php-soap/encoding#73: This PR updates the throws allowlist used by the reporting tooling introduced in #73.
Merge Risk: Minimal · up to 6e8b1

This PR changes only test code and the throws allowlist to make exception attribution independent of allocator address reuse. It has no production impact. No concrete merge-blocking problem was found.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@veewee
veewee merged commit add0daa into main Nov 20, 2026
33 of 34 checks passed
@veewee
veewee deleted the fix-throws-xdebug-address-reuse branch November 20, 2026 15:49
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