Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.10.2
-
Fix Version/s: 1.10.3
-
Component/s: Zend_File_Transfer
-
Labels:None
Description
Hi there,
There is a little bug in the code of setOptions function.
public function setOptions($options = array(), $files = null) { $file = $this->_getFiles($files, false, true); if (is_array($options)) { if ($file === null) { $this->_options = array_merge($this->_options, $options); } foreach ($options as $name => $value) { foreach ($file as $key => $content) { switch ($name) { case 'magicFile' : $this->_files[$key]['options'][$name] = (string) $value; break; case 'ignoreNoFile' : case 'useByteString' : $this->_files[$key]['options'][$name] = (boolean) $value; break; default: require_once 'Zend/File/Transfer/Exception.php'; throw new Zend_File_Transfer_Exception("Unknown option: $name = $value"); } } } } return $this; }
The bug is in the line where $file is checked.
The code:
...
$file = $this->_getFiles($files, false, true);
if (is_array($options)) {
if ($file === null) { //the bug
$this->_options = array_merge($this->_options, $options);
}
...
Here $file is never null so the options passed to the Zend_File_Transfer_Adapter_Abstract are never applied.
The solution is:
...
if (is_array($options)) {
if (empty($file)) { //replacing $file === null with empty($file)
$this->_options = array_merge($this->_options, $options);
}
...
Issue Links
| This issue duplicates: | ||||
| ZF-9159 | Zend_File_Transfer_Http::setOptions() fails to modify $_options if Zend_File_Transfer::_getFiles() returns an empty array |
|
|
|
@Hristo
Please, verify that you are using 1.10.2.
This problem has been corrected in
ZF-9159.ZF-9159.