<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
+$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.zip';
$alias = 'phar://hio';
$phar = new Phar($fname);
try {
var_dump($phar['a.php']->isExecutable());
$phar['a.php']->chmod(0777);
- var_dump($phar['a.php']->isExecutable());
+ copy($fname, $fname2);
+ $phar2 = new Phar($fname2);
+ var_dump($phar2['a.php']->isExecutable());
$phar['a.php']->chmod(0666);
var_dump($phar['a.php']->isExecutable());
echo "test dir\n";
?>
===DONE===
--CLEAN--
-<?php
+<?php
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.zip');
?>
--EXPECT--
bool(false)
phar_zip_extra_field_header header;
phar_zip_unix3 unix3;
} h;
+ int read;
do {
if (sizeof(h.header) != php_stream_read(fp, (char *) &h.header, sizeof(h.header))) {
return FAILURE;
}
- /* clean up header for big-endian systems */
- if (h.header.tag[0] != 'u' || h.header.tag[1] != 'n') {
+ if (h.header.tag[0] != 'n' || h.header.tag[1] != 'u') {
/* skip to next header */
php_stream_seek(fp, PHAR_GET_16(h.header.size), SEEK_CUR);
len -= PHAR_GET_16(h.header.size) + 4;
continue;
}
/* unix3 header found */
- /* clean up header for big-endian systems */
- if (sizeof(h.unix3) != php_stream_read(fp, (char *) &h.unix3, sizeof(h.unix3))) {
- if (PHAR_GET_16(h.unix3.size) > sizeof(h.unix3) - 4) {
- /* skip symlink filename - we may add this support in later */
- php_stream_seek(fp, h.unix3.size - sizeof(h.unix3.size), SEEK_CUR);
- }
- /* set permissions */
- entry->flags &= PHAR_ENT_COMPRESSION_MASK;
- if (entry->is_dir) {
- entry->flags |= PHAR_GET_16(h.unix3.perms) & PHAR_ENT_PERM_DEF_DIR;
- } else {
- entry->flags |= PHAR_GET_16(h.unix3.perms) & PHAR_ENT_PERM_DEF_FILE;
- }
+ read = php_stream_read(fp, (char *) &(h.unix3.crc32), sizeof(h.unix3) - sizeof(h.header));
+ len -= read + 4;
+ if (sizeof(h.unix3) - sizeof(h.header) != read) {
+ return FAILURE;
+ }
+ if (PHAR_GET_16(h.unix3.size) > sizeof(h.unix3) - 4) {
+ /* skip symlink filename - we may add this support in later */
+ php_stream_seek(fp, h.unix3.size - sizeof(h.unix3.size), SEEK_CUR);
+ }
+ /* set permissions */
+ entry->flags &= PHAR_ENT_COMPRESSION_MASK;
+ if (entry->is_dir) {
+ entry->flags |= PHAR_GET_16(h.unix3.perms) & PHAR_ENT_PERM_MASK;
+ } else {
+ entry->flags |= PHAR_GET_16(h.unix3.perms) & PHAR_ENT_PERM_MASK;
}
} while (len);
return SUCCESS;