[wp-trac] [WordPress Trac] #50482: Uncaught Exception: Serialization of 'Closure' is not allowed when run PHPUnit in plugin development

WordPress Trac noreply at wordpress.org
Fri Jun 26 15:21:03 UTC 2020


#50482: Uncaught Exception: Serialization of 'Closure' is not allowed when run
PHPUnit in plugin development
------------------------------+------------------------------
 Reporter:  yshinoda          |       Owner:  (none)
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Build/Test Tools  |     Version:  trunk
 Severity:  normal            |  Resolution:
 Keywords:  close             |     Focuses:
------------------------------+------------------------------
Changes (by swissspidy):

 * keywords:   => close
 * component:  General => Build/Test Tools


Comment:

 In your tests that use `@runInSeparateProcess`, are you using anonymous
 functions (closures) ''anywhere''?

 Because PHP cannot serialize anonmyous functions. The
 `@runInSeparateProcess` feature requires serialization, for instance of
 the data from a data provider.

 So this error message is expected behavior, and is not an issue with the
 WordPress test suite, but just how PHPUnit works.

 See https://github.com/sebastianbergmann/phpunit/issues/2739

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50482#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list