Remove Fallback::iconv()
[lhc/web/wiklou.git] / includes / utils / ZipDirectoryReader.php
index 7bf538a..454a97b 100644 (file)
@@ -93,27 +93,27 @@ class ZipDirectoryReader {
        }
 
        /** The file name */
-       var $fileName;
+       protected $fileName;
 
        /** The opened file resource */
-       var $file;
+       protected $file;
 
        /** The cached length of the file, or null if it has not been loaded yet. */
-       var $fileLength;
+       protected $fileLength;
 
        /** A segmented cache of the file contents */
-       var $buffer;
+       protected $buffer;
 
        /** The file data callback */
-       var $callback;
+       protected $callback;
 
        /** The ZIP64 mode */
-       var $zip64 = false;
+       protected $zip64 = false;
 
        /** Stored headers */
-       var $eocdr, $eocdr64, $eocdr64Locator;
+       protected $eocdr, $eocdr64, $eocdr64Locator;
 
-       var $data;
+       protected $data;
 
        /** The "extra field" ID for ZIP64 central directory entries */
        const ZIP64_EXTRA_HEADER = 0x0001;
@@ -247,8 +247,8 @@ class ZipDirectoryReader {
                );
                $structSize = $this->getStructSize( $info );
 
-               $block = $this->getBlock( $this->getFileLength() - $this->eocdr['EOCDR size']
-                       - $structSize, $structSize );
+               $start = $this->getFileLength() - $this->eocdr['EOCDR size'] - $structSize;
+               $block = $this->getBlock( $start, $structSize );
                $this->eocdr64Locator = $data = $this->unpack( $block, $info );
 
                if ( $data['signature'] !== "PK\x06\x07" ) {
@@ -430,9 +430,7 @@ class ZipDirectoryReader {
                                $year, $month, $day, $hour, $minute, $second );
 
                        // Convert the character set in the file name
-                       if ( !function_exists( 'iconv' )
-                               || $this->testBit( $data['general bits'], self::GENERAL_UTF8 )
-                       ) {
+                       if ( $this->testBit( $data['general bits'], self::GENERAL_UTF8 ) ) {
                                $name = $data['name'];
                        } else {
                                $name = iconv( 'CP437', 'UTF-8', $data['name'] );
@@ -546,6 +544,9 @@ class ZipDirectoryReader {
         * If there are not enough bytes in the file to satisfy the request, the
         * return value will be truncated. If a request is made for a segment beyond
         * the end of the file, an empty string will be returned.
+        *
+        * @param int $segIndex
+        *
         * @return string
         */
        function getSegment( $segIndex ) {
@@ -704,7 +705,7 @@ class ZipDirectoryReader {
  * Internal exception class. Will be caught by private code.
  */
 class ZipDirectoryReaderError extends Exception {
-       var $errorCode;
+       protected $errorCode;
 
        function __construct( $code ) {
                $this->errorCode = $code;