Workaround for PHP bug 45028
This commit is contained in:
parent
f591f22029
commit
ab0e8455b6
|
@ -45,7 +45,7 @@ class downloadalbum_Controller extends Controller {
|
|||
$f_namelen = strlen($f);
|
||||
$f_size = filesize($f);
|
||||
$f_mtime = $this->unix2dostime(filemtime($f));
|
||||
$f_crc32 = hexdec(hash_file('crc32b', $f, false));
|
||||
$f_crc32 = $this->fixBug45028(hexdec(hash_file('crc32b', $f, false)));
|
||||
|
||||
// Local file header
|
||||
echo pack('VvvvVVVVvva' . $f_namelen,
|
||||
|
@ -255,4 +255,14 @@ class downloadalbum_Controller extends Controller {
|
|||
$timebit['mday'] << 16 | $timebit['hours'] << 11 |
|
||||
$timebit['minutes'] << 5 | $timebit['seconds'] >> 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* See http://bugs.php.net/bug.php?id=45028
|
||||
*/
|
||||
private function fixBug45028($hash) {
|
||||
return (version_compare(PHP_VERSION, '5.2.7', '<'))
|
||||
? (($hash & 0x000000ff) << 24) + (($hash & 0x0000ff00) << 8)
|
||||
+ (($hash & 0x00ff0000) >> 8) + (($hash & 0xff000000) >> 24)
|
||||
: $hash;
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue
Block a user