Skip to content

Serialization of 'Closure' is not allowed when using @runInSeparateProcess #4371

@enumag

Description

@enumag
Q A
PHPUnit version 9.2.5
PHP version 7.4.7
Installation Method Composer

Summary

One of our tests started failing with Serialization of 'Closure' is not allowed. When I removed the @runInSeparateProcess (which I have to keep as workaround for https://bugs.php.net/bug.php?id=79646) I got an entirely different error which helped me find the problem in the test.

Apparently there is some issue with process isolation - the data that are serialized to be sent back to the original process contain a Closure and the serialization fails as a result.

Note: This has nothing to do with #2739 - that's about sending data into the test, this is about getting data back.

I'm not sure what data are serialized and where the serialization happens so I'm unable to provide more details and a reproducer for now. Can you point me where in PHPUnit's source code this serialization happens? (Using -v and --debug didn't get me a stack trace.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions