Issues

ZF2-585: Filtering value more than one time

Issue Type: Bug Created: 2012-09-25T12:11:39.000+0000 Last Updated: 2012-10-08T20:11:02.000+0000 Status: Closed Fix version(s): Reporter: Gandzy Ghennady (ghennady) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\Filter

  • Zend\InputFilter

Related issues: Attachments:

Description

<pre class="highlight">

    /**
     * @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

<pre class="highlight">
   $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



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

Comments

Posted by Ralph Schindler (ralph) on 2012-10-08T20:11:02.000+0000

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

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts