Browse Source

ZF-11171
Added appropriate missing fclose calls to Zend_Translate_Adapter_Gettext


git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23903 44c647ce-9c0f-0410-b52a-842ac1e357ba

adamlundrigan 14 năm trước cách đây
mục cha
commit
1618b4c30e

+ 4 - 0
library/Zend/Translate/Adapter/Gettext.php

@@ -72,6 +72,7 @@ class Zend_Translate_Adapter_Gettext extends Zend_Translate_Adapter {
             throw new Zend_Translate_Exception('Error opening translation file \'' . $filename . '\'.');
             throw new Zend_Translate_Exception('Error opening translation file \'' . $filename . '\'.');
         }
         }
         if (@filesize($filename) < 10) {
         if (@filesize($filename) < 10) {
+            @fclose($this->_file);
             require_once 'Zend/Translate/Exception.php';
             require_once 'Zend/Translate/Exception.php';
             throw new Zend_Translate_Exception('\'' . $filename . '\' is not a gettext file');
             throw new Zend_Translate_Exception('\'' . $filename . '\' is not a gettext file');
         }
         }
@@ -83,6 +84,7 @@ class Zend_Translate_Adapter_Gettext extends Zend_Translate_Adapter {
         } else if (strtolower(substr(dechex($input[1]), -8)) == "de120495") {
         } else if (strtolower(substr(dechex($input[1]), -8)) == "de120495") {
             $this->_bigEndian = true;
             $this->_bigEndian = true;
         } else {
         } else {
+            @fclose($this->_file);
             require_once 'Zend/Translate/Exception.php';
             require_once 'Zend/Translate/Exception.php';
             throw new Zend_Translate_Exception('\'' . $filename . '\' is not a gettext file');
             throw new Zend_Translate_Exception('\'' . $filename . '\' is not a gettext file');
         }
         }
@@ -131,6 +133,8 @@ class Zend_Translate_Adapter_Gettext extends Zend_Translate_Adapter {
                 }
                 }
             }
             }
         }
         }
+        
+        @fclose($this->_file);
 
 
         $this->_data[$locale][''] = trim($this->_data[$locale]['']);
         $this->_data[$locale][''] = trim($this->_data[$locale]['']);
         if (empty($this->_data[$locale][''])) {
         if (empty($this->_data[$locale][''])) {