Issues

ZF2-585: Filtering value more than one time

Description



    /**
     * @return mixed
     */
    public function getValue()
    {
        $filter = $this->getFilterChain();
        return $filter->filter($this->value);
    }

In case filter have filters Zend\Filter\File\Rename, Zend\Filter\File\LowerCase, Zend\Filter\File\UpperCase, each call getValue() call filters, and we have result is different from the expected. Following example


   $source = __DIR__ . '/_files/toRename.txt';
   $testSource = __DIR__ . '/_files/_toRename.txt';
   if (!file_exists($testSource))
      copy($source, $testSource);

   $target = __DIR__ . '/_files/renamed.txt';


   $input = new Input('foo');

   $input->setValue($testSource);

   $filter = new Filter\File\Rename(
      array('target' => $target, 'overwrite' => true)
   );
   $input->getFilterChain()->attach($filter);

   $this->assertEquals($target, $input->getValue()); //Pass
   $this->assertEquals($target, $input->getValue()); //Fail

   if ($input->isValid()) //call $input->GetValue()
     $value = $input->getValue() // result is different from the expected

Comments

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2610