Skip to content

Fix STDERR pollution corrupting exception serialization + silent exception swallowing#255

Merged
freekmurze merged 2 commits intomainfrom
fix/stderr-pollution-and-silent-exception-swallowing
Feb 9, 2026
Merged

Fix STDERR pollution corrupting exception serialization + silent exception swallowing#255
freekmurze merged 2 commits intomainfrom
fix/stderr-pollution-and-silent-exception-swallowing

Conversation

@freekmurze
Copy link
Copy Markdown
Member

Summary

  • STDERR pollution fix: When PHP emits deprecation notices/warnings to STDERR during child task execution, the serialized exception data written to the same stream gets corrupted. The parent process can't deserialize the combined output and falls back to an empty ParallelError. Fixed by using a ___SPATIE_ASYNC_CHILD___ delimiter marker — the child prepends it before the serialized data, and the parent uses strrpos() to extract only the data after it.
  • Silent exception swallowing fix: When catch() handlers are registered but none match the thrown exception type, the exception was silently swallowed. Now the exception is thrown if no handler matches.

Test plan

  • Added test: child emits trigger_error() warning then throws — verifies original exception type is preserved
  • Added test: only a non-matching typed catch handler is registered — verifies the exception is thrown
  • All existing tests pass

Fixes #254

🤖 Generated with Claude Code

freekmurze and others added 2 commits February 9, 2026 16:06
…ception swallowing

When PHP emits deprecation notices or warnings to STDERR during child task
execution, the serialized exception data on the same stream gets corrupted,
causing the parent to fall back to an empty ParallelError. Fix by using a
unique delimiter marker so the parent can extract the serialized data
regardless of preceding noise.

Also fix a bug where exceptions were silently swallowed when catch handlers
were registered but none matched the thrown exception type.

Fixes #254

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@freekmurze freekmurze merged commit a34c475 into main Feb 9, 2026
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.

Throwing exception in a child results in empty ParralelError in catch()

1 participant