Skip to content

Commit

Permalink
PhpZipStream updated to work properly on php 5.3 - see owncloud/core#…
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 committed Mar 17, 2014
1 parent 184f0a5 commit da3c9f6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInit9cd2e48c9ff37a90f0f58c866181cdfe::getLoader();
return ComposerAutoloaderInit30ba9da4fd17087c570c63548ec71080::getLoader();
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit9cd2e48c9ff37a90f0f58c866181cdfe
class ComposerAutoloaderInit30ba9da4fd17087c570c63548ec71080
{
private static $loader;

Expand All @@ -19,9 +19,9 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInit9cd2e48c9ff37a90f0f58c866181cdfe', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit30ba9da4fd17087c570c63548ec71080', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit9cd2e48c9ff37a90f0f58c866181cdfe', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit30ba9da4fd17087c570c63548ec71080', 'loadClassLoader'));

$vendorDir = dirname(__DIR__);
$baseDir = $vendorDir;
Expand All @@ -45,14 +45,14 @@ public static function getLoader()

$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
composerRequire9cd2e48c9ff37a90f0f58c866181cdfe($file);
composerRequire30ba9da4fd17087c570c63548ec71080($file);
}

return $loader;
}
}

function composerRequire9cd2e48c9ff37a90f0f58c866181cdfe($file)
function composerRequire30ba9da4fd17087c570c63548ec71080($file)
{
require $file;
}
24 changes: 12 additions & 12 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,6 @@
"vCard"
]
},
{
"name": "mcnetic/phpzipstreamer",
"version": "master",
"version_normalized": "9999999-dev",
"source": {
"type": "git",
"url": "https://github.com/McNetic/PHPZipStreamer.git",
"reference": "master"
},
"type": "library",
"installation-source": "source"
},
{
"name": "symfony/process",
"version": "v2.4.2",
Expand Down Expand Up @@ -256,5 +244,17 @@
"framework",
"iCalendar"
]
},
{
"name": "mcnetic/phpzipstreamer",
"version": "master",
"version_normalized": "9999999-dev",
"source": {
"type": "git",
"url": "https://github.com/McNetic/PHPZipStreamer.git",
"reference": "master"
},
"type": "library",
"installation-source": "source"
}
]
10 changes: 6 additions & 4 deletions mcnetic/phpzipstreamer/ZipStreamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ private function streamFileData($stream, $compress) {

flush();
}
return array($dataLength, $gzLength, unpack('N', hash_final($hashCtx, true))[1]);
$crc = unpack('N', hash_final($hashCtx, true));
return array($dataLength, $gzLength, $crc[1]);
}

private function buildZip64ExtendedInformationField($dataLength = 0, $gzLength = 0) {
Expand Down Expand Up @@ -323,7 +324,7 @@ private function buildZip64EndOfCentralDirectoryLocator($cdRecLength) {
// zip64 end of central directory 4 bytes
. $this->pack64le($zip64RecStart) // relative offset of the zip64 end of
// central directory record 8 bytes
. $this->pack32le(0); // total number of disks 4 bytes
. $this->pack32le(1); // total number of disks 4 bytes
}

private function buildCentralDirectoryHeader($filePath, $timestamp, $gpFlags,
Expand Down Expand Up @@ -429,8 +430,9 @@ private static function pack32le($data) {
private static function pack64le($data) {
if (is_object($data)) {
if ("Count64_32" == get_class($data)) {
$hiBytess = $data->_getValue()[0];
$loBytess = $data->_getValue()[1];
$value = $data->_getValue();
$hiBytess = $value[0];
$loBytess = $value[1];
} else {
$hiBytess = ($data->_getValue() & self::INT64_HIGH_MAP) >> 32;
$loBytess = $data->_getValue() & self::INT64_LOW_MAP;
Expand Down

0 comments on commit da3c9f6

Please sign in to comment.