v1.3.0 Catchable fatal error: Argument 3 passed to ZF\ContentValidation\ContentValidationListenerFactory::__invoke() must be of the type array
asaxena187 opened this issue · 8 comments
Getting this error after updating to v1.3.0: Catchable fatal error: Argument 3 passed to ZF\ContentValidation\ContentValidationListenerFactory::__invoke() must be of the type array, string given in /<my_path>/vendor/zfcampus/zf-content-validation/src/ContentValidationListenerFactory.php on line 21
not sure what is causing it or if I'm missing anything else after the update, any help would be great...
Hey,
I'm having the same issue than @asaxena187. After some debugging, essentially dumping, I noticed that the value passed for $options
is not what the factory would expect.
The current code use this signature:
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
When i remove the array
typing for $options
, then check contents with var_dump($options);
, here is what i get:
/path/to/ContentValidationListenerFactory.php:23:string 'ZF\ContentValidation\ContentValidationListener' (length=46)
A string
for an array
, as error states.
Yet even more strange, the current code does not seem to use these $options:
https://github.com/zfcampus/zf-content-validation/blob/master/src/ContentValidationListenerFactory.php#L21-32
Hope that would help someone understand what's going on.
@asaxena187, @e7d, If you are looking for temporary solution, this PR fix this issues : #71
Is there any final solution? Merge for this? zf-content-validation is required by zf-apigility-admin an causes errors @1.3.0
v1.3.1 is still unusable due to this error.
Simply, ContentValidationListenerFactory is incompatible with Service Manager v2 in part of createFromFactory method (is_callable check & putting $requestedName to options in old way) & tested only with v3.
Should be fixed with #76
Closed with 1.3.2 release.