Zend Framework

allowEmpty = false is ineffective if input rule has multiple fields

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.1
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Filter_Input
  • Labels:
    None
  • Fix Version Priority:
    Should Have

Description

Issue reported by Jim Scherer.

Below is code to demonstrate the failure:

<?php

require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

$filters = array( );

$validators = array(
    'test' => array(
        'allowEmpty' => false,
        'fields' => array( 'empty', 'notempty' )
    )
);

$data = array(
    'empty' => '',
    'notempty' => 'not empty'
);

$input = new Zend_Filter_Input( $filters, $validators, $data );

// expect input to be invalid
echo "\ninput->isValid =\n";
var_dump($input->isValid());

echo "\nvalidators =\n";
var_dump($validators);

// echo "\ninput object =\n";
// echo var_dump($input);

echo "\nempty(data[empty]) =\n";
var_dump(empty($data['empty']));

echo "\nempty(data[notempty]) =\n";
var_dump(empty($data['notempty']));

Issue Links

Activity

Hide
Bill Karwin added a comment -

Confirmed that isValid() returns true, which is wrong for the example case above.

Show
Bill Karwin added a comment - Confirmed that isValid() returns true, which is wrong for the example case above.
Hide
Bill Karwin added a comment -

Changing to 'Unassigned'

Show
Bill Karwin added a comment - Changing to 'Unassigned'
Hide
Wil Sinclair added a comment -

This issue should have been fixed for the 1.5 release.

Show
Wil Sinclair added a comment - This issue should have been fixed for the 1.5 release.
Hide
Wil Sinclair added a comment -

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Show
Wil Sinclair added a comment - This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.
Hide
Wil Sinclair added a comment -

Please evaluate and categorize/assign as necessary.

Show
Wil Sinclair added a comment - Please evaluate and categorize/assign as necessary.
Hide
Benjamin Eberlei added a comment -

I will spend some time on it later this week.

Show
Benjamin Eberlei added a comment - I will spend some time on it later this week.
Hide
Thomas Weidner added a comment -

Running the above code on actual trunk I get the expected and wished result.
Closing this issue as fixed for the next release as I'm unsure when it was really fixed.

Show
Thomas Weidner added a comment - Running the above code on actual trunk I get the expected and wished result. Closing this issue as fixed for the next release as I'm unsure when it was really fixed.

People

Vote (2)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
1d
Original Estimate - 1 day
Remaining:
1d
Remaining Estimate - 1 day
Logged:
Not Specified
Time Spent - Not Specified