laminas/laminas-hydrator

FilterComposite issue with Swoole 4.4.0 and higher

weierophinney opened this issue · 1 comments

  • I was not able to find an open or closed issue matching what I'm seeing.
  • This is not a question. (Questions should be asked on chat (Signup here) or our forums.)

Provide a narrative description of what you are trying to accomplish.

From Swoole v4.0.0, the extension replaces 'array_walk' and 'array_walk_recursive' with its own versions.

An excerpt fro the release notes under new features:

When RuntimeHook is turned on, the function array_walk, 
array_walk_recursive will be replaced by the version of Swoole, 
which will solve the problem that the native function cannot be reentrant, 
but it will not be able to traverse object

The replacement triggers the below error from within \Zend\Hydrator\Filter\FilterComposite constructor:

Argument 2 passed to swoole_array_walk() must be callable, array given

Wrapping the 'array_walk' function in 'Closure::fromCallable' solves the problem (PHP 7.3, Swoole 4.4.1), but it may not be a comprehensive solution for the library's support matrix.


Originally posted by @MassiAtHG at zendframework/zend-hydrator#104

👍 I have the same error and same fix


Originally posted by @fezfez at zendframework/zend-hydrator#104 (comment)