Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Zend Validators complain of array to string conversion for nested array values that do not pass validation when using E_NOTICE #3055

Closed
michaelmoussa opened this issue Nov 23, 2012 · 1 comment
Assignees
Milestone

Comments

@michaelmoussa
Copy link
Contributor

See https://github.com/zendframework/zf2/blob/release-2.0.4/library/Zend/Validator/AbstractValidator.php#L305-L307.

The problem is that implode(...) only goes one level deep. If you have an input such as the following

array(
    'phoneNumbers' => array(
        array('home' => '1234567890'),
        array('mobile' => '0987654321')
    )
);

The lines referenced in the link above will trigger a notice when running with an error reporting level that includes E_NOTICE.

A possible solution would be to use something like print_r($value, true) instead of implode(...)

weierophinney added a commit to weierophinney/zendframework that referenced this issue Jan 18, 2013
- Removes an array to string conversion notice when nested arrays are
  provided as values
@ghost ghost assigned weierophinney Jan 18, 2013
@Maks3w Maks3w closed this as completed Jan 22, 2013
@michaelmoussa
Copy link
Contributor Author

Thanks!

weierophinney added a commit to zendframework/zend-validator that referenced this issue May 15, 2015
…notice

- Removes an array to string conversion notice when nested arrays are
  provided as values
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants