ZF2-299: Callback Validator second arg is array of the form fields

Issue Type: Bug Created: 2012-05-12T11:25:02.000+0000 Last Updated: 2012-06-26T14:13:04.000+0000 Status: Resolved Fix version(s): Reporter: Michael Ben-Nes (mbn_18) Assignee: Matthew Weier O'Phinney (matthew) Tags: - callback

  • form
  • validator
  • zf2

Related issues: Attachments:


Component: Zend\Validator\Callback

This is the inputFilter:

<pre class="highlight">
    'name'       => 'username',
    'required'   => true,
    'filters'    => array(
            'name'    => 'StripTags',
    'validators' => array(
            'name'              => 'Callback',
            'options'           => array(
                'callback'      => array($model, 'userNameAvilable'),
            'callbackOptions'   => array('value I need'),
                'messages'   => array(
                    'callbackValue'  => "This username is already taken",

If I dump Zend\Validator\Callback at Line 144 var_dump(array_merge($args, $options)); die();

I get

<pre class="highlight">
array(3) {
  string(17) "invented_username"
  array(7) {
    string(17) "invented_username"
    string(0) ""
    string(0) ""
    string(0) ""
    string(0) ""
    string(7) "student"
    string(4) "Send"
  string(12) "value I need"


Posted by Matthew Weier O'Phinney (matthew) on 2012-05-14T14:43:45.000+0000

In looking at this, I think that the $context should be passed as an array as the value immediately following $value, before any other callback options. I've done this here:…

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.