[fw-general] Bug in Zend_File_transfer
|For example $upload = new Zend_File_Transfer(); $||upload ||-setDestination('some path') $upload-addFilter('Rename', 'C:\new\n1', 'file1') -addFilter('Rename', 'C:\new\w1', 'file2'); This is only example but only works one the last filter I have problem adding the same filter and propably validator to two diffrent files want work beacuse there will be used only the last filter There is in code a bug $this-_filters[$class] = $filter; on line 683 in zend_file_adpter_abstract and for validators will be the same or i am doing something wrong sorry for english |
Re: [fw-general] Bug in Zend_File_transfer
kamil pisze: |For example $upload = new Zend_File_Transfer(); $||upload ||-setDestination('some path') $upload-addFilter('Rename', 'C:\new\n1', 'file1') -addFilter('Rename', 'C:\new\w1', 'file2'); This is only example but only works one the last filter I have problem adding the same filter and propably validator to two diffrent files want work beacuse there will be used only the last filter There is in code a bug $this-_filters[$class] = $filter; on line 683 in zend_file_adpter_abstract and for validators will be the same or i am doing something wrong sorry for english | I saw an note in manual Note that even though setting the same filter multiple times is allowed, doing so can lead to issues when using different options for the same filter. But for me this is a bug and in this case i can`t change multiple files , you cant add the same filter with dirffent options to 2 diffrent files
Re: [fw-general] Bug in Zend_File_transfer
Just to note... Your reproduction example can impossibly work. It throws an exception at initiation. Greetings Thomas Weidner - Original Message - From: kamil luznyg...@poczta.onet.pl To: fw-general@lists.zend.com Sent: Thursday, January 29, 2009 1:56 PM Subject: [fw-general] Bug in Zend_File_transfer |For example $upload = new Zend_File_Transfer(); $||upload ||-setDestination('some path') $upload-addFilter('Rename', 'C:\new\n1', 'file1') -addFilter('Rename', 'C:\new\w1', 'file2'); This is only example but only works one the last filter I have problem adding the same filter and propably validator to two diffrent files want work beacuse there will be used only the last filter There is in code a bug $this-_filters[$class] = $filter; on line 683 in zend_file_adpter_abstract and for validators will be the same or i am doing something wrong sorry for english |
Re: [fw-general] Bug in Zend_File_transfer
Thomas Weidner pisze: Just to note... Your reproduction example can impossibly work. It throws an exception at initiation. Greetings Thomas Weidner - Original Message - From: kamil luznyg...@poczta.onet.pl To: fw-general@lists.zend.com Sent: Thursday, January 29, 2009 1:56 PM Subject: [fw-general] Bug in Zend_File_transfer |For example $upload = new Zend_File_Transfer(); $||upload ||-setDestination('some path') $upload-addFilter('Rename', 'C:\new\n1', 'file1') -addFilter('Rename', 'C:\new\w1', 'file2'); This is only example but only works one the last filter I have problem adding the same filter and propably validator to two diffrent files want work beacuse there will be used only the last filter There is in code a bug $this-_filters[$class] = $filter; on line 683 in zend_file_adpter_abstract and for validators will be the same or i am doing something wrong sorry for english | try this ,, maybe i did somthing wrong , now i dont have this code , because i did this by my way $adapter = new Zend_File_Transfer_Adapter_Http(array('ignoreNoFile' = true)); $adapter-setDestination(Zend_Registry::get('config')-files) $adapter-addFilter('Rename', array('target' = Zend_Registry::get('config')-files.'note_'.$id,'overwrite' = true), 'note') -addFilter('Rename', array('target' = Zend_Registry::get('config')-files.'terms_'.$id,'overwrite' = true), 'terms');
[fw-general] Bug with Zend_File_Transfer
it seem that each validation for the file elements in the zend_form would validate all of the file elements in the form.it means that if there have two file elements in the form,says A and B. So isValid() for the element A is called,it would validate A and B,not just A. So if i want to upload two files, one is option, and another is required,then would result in error if i left the option one empty. do you understand me? if you don't , try the following: ?php $form = new Zend_Form(); $form-setEnctype(Zend_Form::ENCTYPE_MULTIPART); // file a,optional $a = new Zend_Form_Element_File('A'); $a-setLabel('file a'); $form-addElement($a); // file b,required $b = new Zend_Form_Element_File('B'); $b-setLabel('file b'); $b-setRequired(true); $form-addElement($b); if ($this-_request-isPost()) { if ($form-isValid($_POST)) { echo 'valid'; } else { echo 'invalid'; } } echo $form;
Re: [fw-general] Bug with Zend_File_Transfer
thanks your rapid reply. 2008/9/19 Thomas Weidner [EMAIL PROTECTED] Jacky, this is not supported for now and has been reported several times in the last few days. A issue is already filled and in work. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: Jacky Chen [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Friday, September 19, 2008 8:47 AM Subject: [fw-general] Bug with Zend_File_Transfer it seem that each validation for the file elements in the zend_form would validate all of the file elements in the form.it means that if there have two file elements in the form,says A and B. So isValid() for the element A is called,it would validate A and B,not just A. So if i want to upload two files, one is option, and another is required,then would result in error if i left the option one empty. do you understand me? if you don't , try the following: ?php $form = new Zend_Form(); $form-setEnctype(Zend_Form::ENCTYPE_MULTIPART); // file a,optional $a = new Zend_Form_Element_File('A'); $a-setLabel('file a'); $form-addElement($a); // file b,required $b = new Zend_Form_Element_File('B'); $b-setLabel('file b'); $b-setRequired(true); $form-addElement($b); if ($this-_request-isPost()) { if ($form-isValid($_POST)) { echo 'valid'; } else { echo 'invalid'; } } echo $form;
[fw-general] Bug with Zend_File_Transfer
Hi there, there is a bug in the Zend_File_Transfer_Abstract::setOptions() , the code in the setOptions() as bellow: if (is_array($options)) { $this-_options += $options; } Maybe the following code should it be: if (is_array($options)) { $this-_options = $options + $this-_options; }
Re: [fw-general] Bug with Zend_File_Transfer
No, actually it should not. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: Jacky Chen [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Thursday, September 11, 2008 9:32 AM Subject: [fw-general] Bug with Zend_File_Transfer Hi there, there is a bug in the Zend_File_Transfer_Abstract::setOptions() , the code in the setOptions() as bellow: if (is_array($options)) { $this-_options += $options; } Maybe the following code should it be: if (is_array($options)) { $this-_options = $options + $this-_options; }