#define PHAR_API_MAJORVER_MASK 0xF000
#define PHAR_API_VER_MASK 0xFFF0
-#define PHAR_HDR_COMPRESSION_MASK 0x000F
-#define PHAR_HDR_COMPRESSED_NONE 0x000F
-#define PHAR_HDR_COMPRESSED_GZ 0x0001
-#define PHAR_HDR_COMPRESSED_BZ2 0x0002
-#define PHAR_HDR_SIGNATURE 0x0010
+#define PHAR_HDR_COMPRESSION_MASK 0x0000F000
+#define PHAR_HDR_COMPRESSED_NONE 0x00000000
+#define PHAR_HDR_COMPRESSED_GZ 0x00001000
+#define PHAR_HDR_COMPRESSED_BZ2 0x00002000
+#define PHAR_HDR_SIGNATURE 0x00010000
#define PHAR_SIG_MD5 0x0001
#define PHAR_SIG_SHA1 0x0002
/* flags byte for each file adheres to these bitmasks.
All unused values are reserved */
-#define PHAR_ENT_COMPRESSION_MASK 0x00001C00
+#define PHAR_ENT_COMPRESSION_MASK 0x0000F000
#define PHAR_ENT_COMPRESSED_NONE 0x00000000
-#define PHAR_ENT_COMPRESSED_GZ 0x00000200
-#define PHAR_ENT_COMPRESSED_BZ2 0x00000400
+#define PHAR_ENT_COMPRESSED_GZ 0x00001000
+#define PHAR_ENT_COMPRESSED_BZ2 0x00002000
#define PHAR_ENT_PERM_MASK 0x000001FF
#define PHAR_ENT_PERM_MASK_USR 0x000001C0
$manifest = '';
foreach($files as $name => $cont) {
$len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', $len, time(), 3, crc32($cont), 0x00000001);
+ $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', $len, time(), 3, crc32($cont), 0x00001000);
}
$alias = 'hio';
-$manifest = pack('VnVV', count($files), 0x0900, 0x00000001, strlen($alias)) . $alias . $manifest;
+$manifest = pack('VnVV', count($files), 0x0900, 0x00001000, strlen($alias)) . $alias . $manifest;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
$files['a'] = array('Hello World', pack('H*', '425a6839314159265359d872012f00000157800010400000400080060490002000220686d420c988c769e8281f8bb9229c28486c39009780'));
$manifest = '';
foreach($files as $name => $cont) {
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', strlen($cont[0]), time(), strlen($cont[1]), crc32($cont[0]), 0x00000002);
+ $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', strlen($cont[0]), time(), strlen($cont[1]), crc32($cont[0]), 0x00002000);
}
$alias = 'hio';
-$manifest = pack('VnVV', count($files), 0x0900, 0x00000002, strlen($alias)) . $alias . $manifest;
+$manifest = pack('VnVV', count($files), 0x0900, 0x00002000, strlen($alias)) . $alias . $manifest;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
// file length is too short
$files = array();
-$files['a'] = array('a', chr(75)/*. chr(4) . chr(0): 'a' gzdeflated */, 0x00000001);
-$files['b'] = array('a', chr(75)/*. chr(4) . chr(0): 'a' gzdeflated */, 0x00000001);
+$files['a'] = array('a', chr(75)/*. chr(4) . chr(0): 'a' gzdeflated */, 0x00001000);
+$files['b'] = array('a', chr(75)/*. chr(4) . chr(0): 'a' gzdeflated */, 0x00001000);
$files['c'] = array('*', '*', 0x00000000);
-$files['d'] = array('a', chr(75)/*. chr(4) . chr(0): 'a' gzdeflated */, 0x00000001);
+$files['d'] = array('a', chr(75)/*. chr(4) . chr(0): 'a' gzdeflated */, 0x00001000);
$manifest = '';
foreach($files as $name => $cont) {
$ulen = strlen($cont[0]);
. pack('VVVVV', $ulen, time(), $clen, crc32($cont[0]), $cont[2]);
}
$alias = 'hio';
-$manifest = pack('VnVV', count($files), 0x0900, 0x00000001, strlen($alias)) . $alias . $manifest;
+$manifest = pack('VnVV', count($files), 0x0900, 0x00001000, strlen($alias)) . $alias . $manifest;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
$manifest = '';
foreach($files as $name => $cont) {
$len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', $len, time(), 1, crc32($cont), 0x00000001);
+ $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', $len, time(), 1, crc32($cont), 0x00001000);
}
$alias = 'hio';
-$manifest = pack('VnVV', count($files), 0x0900, 0x00000001, strlen($alias)) . $alias . $manifest;
+$manifest = pack('VnVV', count($files), 0x0900, 0x00001000, strlen($alias)) . $alias . $manifest;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
{
$ulen = strlen($cont);
$clen = $ulen;
- $time = isset($ftime) ? $ftime : mktime(12, 0, 0, 3, 1, 2006);
+ $time = isset($ftime) ? $ftime : @mktime(12, 0, 0, 3, 1, 2006);
$manifest .= pack('V', strlen($name)) . $name;
$manifest .= pack('VVVVV', $ulen, $time, $clen, crc32($cont), 0x000001B6);
}