ZF-4639: Undefined variable: result in Zend_File_Transfer_Adapter_Abstract

Description

In Zend_File_Transfer_Adapater_Abstract an warning is raised in getFilters().

Notice: Undefined variable: result in library\Zend\File\Transfer\Adapter\Abstract.php on line 809

Fix: $result = array() on top of the last foreach loop

Comments

Duplication of already fixed issue

How is this fixed? I just downloaded 1.6.2, and it's still there....

Just to be precise - the warning is thrown out of getFilters when I came across it in 1.6.2

As mentioned already fixed with r11906

Maybe I'm looking in the wrong place, but... Looking at both r11906 and the 1.6.2 release, I see the fix in the getValidators function, but not in the getFilters function...

Then please give php version and reproducable code... unittests are not showing problems, and also when calling getFilters I see no failure message at all.

Thomas, here is a snippet of code that throws the error. Hope this helps.

PHP 5.2.0 ZF 1.6.2

Running the attached script throws the following in Zend_File_Transfer_Adapter_Abstract on my machine:

PHP Notice: Undefined variable: result in /Users/michel/web-lib/ZendFramework-1.6.2-minimal/library/Zend/File/Transfer/Adapter/Abstract.php on line 803 PHP Warning: Invalid argument supplied for foreach() in /Users/michel/web-lib/ZendFramework-1.6.2-minimal/library/Zend/Form/Element.php on line 524

I also still see an issue with a Zend Form with a File element, as soon as I call form->getData (or whatever it is), it throws that warning.

Sorry, but Zend_Form is not Zend_File_Translate... These are 2 different components from different authors.

When you having problems with getData please open a issue with Zend_Form as component and not Zend_File_Transfer.

In your attached example, based on the call of clearFilters I found a possible problem.

It's fixed with r12055.

Still to mention:

  • Please use the correct component... when a failure is thrown by usage of Zend_Form then attach this component and not another
  • Please add ALWAYS your used php and ZF version
  • Please add reproducabel code... without it it's nearly impossible to help when file uploads are done

{quote} Please use the correct component... when a failure is thrown by usage of Zend_Form then attach this component and not another {quote}

My apologies. I thought it had to be the component that throws the error. I'll keep this, and your other remarks, in mind for the future.