summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2007-01-13 16:17:04 +0000
committerMarcus Boerger <helly@php.net>2007-01-13 16:17:04 +0000
commitc6c23145f466f4ed9756d9941b47efba1e436992 (patch)
tree08993ba65d10c5f72c657522c3ff6d3720dd4b77
parentb1f02b95ceb649e7e8cb2dda3c96d8de61c73169 (diff)
downloadphp-git-c6c23145f466f4ed9756d9941b47efba1e436992.tar.gz
- Change to new layout wich has some more flags that will be used for perms
- Update/simplify tests
-rw-r--r--ext/phar/phar.c169
-rw-r--r--ext/phar/tests/009.phpt2
-rw-r--r--ext/phar/tests/010.phpt4
-rw-r--r--ext/phar/tests/011.phpt4
-rw-r--r--ext/phar/tests/012.phpt18
-rw-r--r--ext/phar/tests/013.phpt6
-rw-r--r--ext/phar/tests/014.phpt4
-rw-r--r--ext/phar/tests/015.phpt4
-rwxr-xr-xext/phar/tests/015b.phpt4
-rw-r--r--ext/phar/tests/016.phpt12
-rwxr-xr-xext/phar/tests/016b.phpt4
-rw-r--r--ext/phar/tests/017.phpt4
-rw-r--r--ext/phar/tests/018.phpt17
-rw-r--r--ext/phar/tests/019.phpt19
-rwxr-xr-xext/phar/tests/019b.phpt19
-rwxr-xr-xext/phar/tests/019c.phpt19
-rw-r--r--ext/phar/tests/020.phpt19
-rw-r--r--ext/phar/tests/021.phpt20
-rw-r--r--ext/phar/tests/022.phpt20
-rwxr-xr-xext/phar/tests/023.phpt22
-rwxr-xr-xext/phar/tests/024.phpt22
-rwxr-xr-xext/phar/tests/025.phpt22
-rwxr-xr-xext/phar/tests/026.phpt15
-rwxr-xr-xext/phar/tests/027.phpt15
-rwxr-xr-xext/phar/tests/028.phpt19
-rwxr-xr-xext/phar/tests/029.phpt19
-rwxr-xr-xext/phar/tests/030.phpt15
-rw-r--r--ext/phar/tests/delete_in_phar.phpt31
-rwxr-xr-xext/phar/tests/delete_in_phar_b.phpt31
-rw-r--r--ext/phar/tests/delete_in_phar_confirm.phpt29
-rw-r--r--ext/phar/tests/open_for_write_existing.phpt21
-rwxr-xr-xext/phar/tests/open_for_write_existing_b.phpt21
-rw-r--r--ext/phar/tests/open_for_write_newfile.phpt23
-rwxr-xr-xext/phar/tests/open_for_write_newfile_b.phpt25
-rwxr-xr-xext/phar/tests/phar_oo_001.phpt2
-rwxr-xr-xext/phar/tests/phar_oo_test.inc16
-rwxr-xr-xext/phar/tests/phar_test.inc23
37 files changed, 251 insertions, 488 deletions
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index ffb924ebb9..9edae0d4d0 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -64,8 +64,11 @@
#define PHAR_API_MAJORVER_MASK 0xF000
#define PHAR_API_VER_MASK 0xFFF0
-#define PHAR_HDR_ANY_COMPRESSED 0x0001
-#define PHAR_HDR_SIGNATURE 0x0008
+#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_SIG_MD5 0x0001
#define PHAR_SIG_SHA1 0x0002
@@ -75,10 +78,10 @@
/* flags byte for each file adheres to these bitmasks.
All unused values are reserved */
-#define PHAR_ENT_COMPRESSION_MASK 0x0F
-#define PHAR_ENT_COMPRESSED_NONE 0x00
-#define PHAR_ENT_COMPRESSED_GZ 0x01
-#define PHAR_ENT_COMPRESSED_BZ2 0x02
+#define PHAR_ENT_COMPRESSION_MASK 0x000F
+#define PHAR_ENT_COMPRESSED_NONE 0x0000
+#define PHAR_ENT_COMPRESSED_GZ 0x0001
+#define PHAR_ENT_COMPRESSED_BZ2 0x0002
/* an entry has been marked as deleted from a writeable phar */
#define PHAR_ENT_DELETED 0x10
@@ -112,15 +115,17 @@ typedef union _phar_archive_object phar_archive_object;
typedef union _phar_entry_object phar_entry_object;
/* entry for one file in a phar file */
-typedef struct _phar_manifest_entry {
- php_uint32 filename_len;
- char *filename;
+typedef struct _phar_entry_info {
+ /* first bytes are exactly as in file */
php_uint32 uncompressed_filesize;
php_uint32 timestamp;
- long offset_within_phar;
php_uint32 compressed_filesize;
php_uint32 crc32;
- char flags;
+ php_uint32 flags;
+ /* remainder */
+ php_uint32 filename_len;
+ char *filename;
+ long offset_within_phar;
zend_bool crc_checked;
php_stream *fp;
php_stream *temp_file;
@@ -136,8 +141,8 @@ typedef struct _phar_archive_data {
char version[12];
size_t internal_file_start;
size_t halt_offset;
- zend_bool has_compressed_files;
HashTable manifest;
+ php_uint32 flags;
php_uint32 min_timestamp;
php_uint32 max_timestamp;
php_stream *fp;
@@ -569,10 +574,9 @@ static int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alia
char b32[4], *buffer, *endbuffer, *savebuf;
phar_archive_data *mydata = NULL;
phar_entry_info entry;
- php_uint32 manifest_len, manifest_count, manifest_index, tmp_len, sig_flags;
- php_uint16 manifest_tag;
+ php_uint32 manifest_len, manifest_count, manifest_flags, manifest_index, tmp_len, sig_flags;
+ php_uint16 manifest_ver;
long offset;
- int compressed = 0;
int register_alias, sig_len;
char *signature = NULL;
@@ -636,22 +640,26 @@ static int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alia
MAPPHAR_FAIL("in phar \"%s\", manifest claims to have zero entries. Phars must have at least 1 entry");
}
- /* extract API version and global compressed flag */
- manifest_tag = (((unsigned char)buffer[0]) << 8)
- + ((unsigned char)buffer[1]);
+ /* extract API version, lowest nibble currently unused */
+ manifest_ver = (((unsigned char)buffer[0]) << 8)
+ + ((unsigned char)buffer[1]);
buffer += 2;
- if ((manifest_tag & PHAR_API_VER_MASK) < PHAR_API_VERSION ||
- (manifest_tag & PHAR_API_MAJORVER_MASK) != PHAR_API_MAJORVERSION)
+ if ((manifest_ver & PHAR_API_VER_MASK) < PHAR_API_VERSION ||
+ (manifest_ver & PHAR_API_MAJORVER_MASK) != PHAR_API_MAJORVERSION)
{
efree(savebuf);
php_stream_close(fp);
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "phar \"%s\" is API version %1.u.%1.u.%1.u, and cannot be processed", fname, manifest_tag >> 12, (manifest_tag >> 8) & 0xF, (manifest_tag >> 4) & 0x0F);
+ php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "phar \"%s\" is API version %1.u.%1.u.%1.u, and cannot be processed", fname, manifest_ver >> 12, (manifest_ver >> 8) & 0xF, (manifest_ver >> 4) & 0x0F);
return FAILURE;
}
+ PHAR_GET_32(buffer, manifest_flags);
+
+ manifest_flags &= ~PHAR_ENT_COMPRESSION_MASK;
+
/* The lowest nibble contains the phar wide flags. The any compressed can */
/* be ignored on reading because it is being generated anyways. */
- if (manifest_tag & PHAR_HDR_SIGNATURE) {
+ if (manifest_flags & PHAR_HDR_SIGNATURE) {
unsigned char buf[1024];
int read_size, len;
char sig_buf[8], *sig_ptr = sig_buf;
@@ -817,7 +825,7 @@ static int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alia
if (entry.filename_len == 0) {
MAPPHAR_FAIL("zero-length filename encountered in phar \"%s\"");
}
- if (buffer + entry.filename_len + 16 + 1 > endbuffer) {
+ if (buffer + entry.filename_len + 20 > endbuffer) {
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)");
}
entry.filename = estrndup(buffer, entry.filename_len);
@@ -836,21 +844,19 @@ static int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alia
}
PHAR_GET_32(buffer, entry.compressed_filesize);
PHAR_GET_32(buffer, entry.crc32);
+ PHAR_GET_32(buffer, entry.flags);
entry.offset_within_phar = offset;
offset += entry.compressed_filesize;
- entry.flags = *buffer++;
switch (entry.flags & PHAR_ENT_COMPRESSION_MASK) {
case PHAR_ENT_COMPRESSED_GZ:
#if !HAVE_ZLIB
MAPPHAR_FAIL("zlib extension is required for gz compressed .phar file \"%s\"");
#endif
- compressed = 1;
break;
case PHAR_ENT_COMPRESSED_BZ2:
#if !HAVE_BZ2
MAPPHAR_FAIL("bz2 extension is required for bzip2 compressed .phar file \"%s\"");
#endif
- compressed = 1;
break;
default:
if (entry.uncompressed_filesize != entry.compressed_filesize) {
@@ -858,15 +864,16 @@ static int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alia
}
break;
}
+ manifest_flags |= (entry.flags & PHAR_ENT_COMPRESSION_MASK);
entry.crc_checked = 0;
entry.fp = NULL;
zend_hash_add(&mydata->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info), NULL);
}
- snprintf(mydata->version, sizeof(mydata->version), "%u.%u.%u", manifest_tag >> 12, (manifest_tag >> 8) & 0xF, (manifest_tag >> 4) & 0xF);
+ snprintf(mydata->version, sizeof(mydata->version), "%u.%u.%u", manifest_ver >> 12, (manifest_ver >> 8) & 0xF, (manifest_ver >> 4) & 0xF);
mydata->internal_file_start = halt_offset + manifest_len + 4;
mydata->halt_offset = halt_offset;
- mydata->has_compressed_files = compressed;
+ mydata->flags = manifest_flags;
mydata->fp = fp;
mydata->fname = estrndup(fname, fname_len);
mydata->fname_len = fname_len;
@@ -1218,35 +1225,35 @@ static php_stream_ops phar_ops = {
phar_stream_close, /* close */
phar_stream_flush, /* flush */
"phar stream",
- phar_stream_seek, /* seek */
- NULL, /* cast */
- phar_stream_stat, /* stat */
+ phar_stream_seek, /* seek */
+ NULL, /* cast */
+ phar_stream_stat, /* stat */
NULL, /* set option */
};
static php_stream_ops phar_dir_ops = {
- phar_dir_write, /* write (does nothing) */
- phar_dir_read, /* read */
+ phar_dir_write, /* write */
+ phar_dir_read, /* read */
phar_dir_close, /* close */
- phar_dir_flush, /* flush (does nothing) */
- "phar stream",
- phar_dir_seek, /* seek */
- NULL, /* cast */
- phar_dir_stat, /* stat */
+ phar_dir_flush, /* flush */
+ "phar dir",
+ phar_dir_seek, /* seek */
+ NULL, /* cast */
+ phar_dir_stat, /* stat */
NULL, /* set option */
};
static php_stream_wrapper_ops phar_stream_wops = {
phar_wrapper_open_url,
- NULL, /* phar_wrapper_close */
- NULL, /* phar_wrapper_stat, */
- phar_wrapper_stat, /* stat_url */
+ NULL, /* phar_wrapper_close */
+ NULL, /* phar_wrapper_stat, */
+ phar_wrapper_stat, /* stat_url */
phar_wrapper_open_dir, /* opendir */
"phar",
- phar_wrapper_unlink, /* unlink */
- NULL, /* rename */
- NULL, /* create directory */
- NULL /* remove directory */
+ phar_wrapper_unlink, /* unlink */
+ NULL, /* rename */
+ NULL, /* create directory */
+ NULL, /* remove directory */
};
php_stream_wrapper php_stream_phar_wrapper = {
@@ -1692,7 +1699,7 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
phar_entry_info *entry;
int alias_len, fname_len, halt_offset, restore_alias_len, global_flags = 0;
char *fname, *alias;
- char *manifest, entry_buffer[20];
+ char manifest[18], entry_buffer[20];
off_t manifest_ftell;
long offset;
php_uint32 copy, loc, new_manifest_count;
@@ -1746,7 +1753,7 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
}
/* after excluding deleted files, calculate manifest size in bytes and number of entries */
++new_manifest_count;
- offset += 21 + entry->filename_len;
+ offset += 4 + entry->filename_len + sizeof(entry_buffer);
/* compress as necessary */
if (entry->flags & PHAR_ENT_MODIFIED) {
@@ -1768,7 +1775,6 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
}
} else {
if (-1 == php_stream_seek(oldfile, entry->offset_within_phar + data->phar->internal_file_start, SEEK_SET)) {
- efree(manifest);
if (oldfile) {
php_stream_close(oldfile);
}
@@ -1782,7 +1788,6 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
if (entry->flags & PHAR_ENT_COMPRESSION_MASK) {
filter = php_stream_filter_create(phar_compress_filter(entry, 0), NULL, 0 TSRMLS_CC);
if (!filter) {
- efree(manifest);
if (oldfile) {
php_stream_close(oldfile);
}
@@ -1816,38 +1821,34 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
entry->temp_file = compfile;
entry->compressed_filesize = copy;
entry->flags |= PHAR_ENT_MODIFIED;
- global_flags |= PHAR_HDR_ANY_COMPRESSED;
+ global_flags |= (entry->flags & PHAR_ENT_COMPRESSION_MASK);
}
}
+ global_flags |= PHAR_HDR_SIGNATURE;
+
/* write out manifest pre-header */
- /* 4: manifest length, 4: manifest entry count, 2: phar version,
- 4: alias length, the rest is the alias itself
- */
+ /* 4: manifest length
+ * 4: manifest entry count
+ * 2: phar version
+ * 4: phar global flags
+ * 4: alias length, the rest is the alias itself
+ */
restore_alias_len = data->phar->alias_len;
- if (data->phar->explicit_alias) {
- manifest = (char *) emalloc(14 + data->phar->alias_len);
- phar_set_32(manifest, offset + data->phar->alias_len + 10); /* manifest length */
- phar_set_32(manifest+4, new_manifest_count);
- phar_set_32(manifest+10, data->phar->alias_len);
- memcpy(manifest + 14, data->phar->alias, data->phar->alias_len);
- } else {
- /* alias was assigned at runtime, do not add to new phar */
- manifest = (char *) emalloc(14);
- phar_set_32(manifest, offset + 10); /* manifest length */
- phar_set_32(manifest+4, new_manifest_count);
- phar_set_32(manifest+10, 0);
+ if (!data->phar->explicit_alias) {
data->phar->alias_len = 0;
}
- global_flags |= PHAR_HDR_SIGNATURE;
-
+ phar_set_32(manifest, offset + data->phar->alias_len + sizeof(manifest) - 4); /* manifest length */
+ phar_set_32(manifest+4, new_manifest_count);
*(manifest + 8) = (unsigned char) (((PHAR_API_VERSION) >> 8) & 0xFF);
- *(manifest + 9) = (unsigned char) (((PHAR_API_VERSION) & 0xF0) | (global_flags & 0x0F));
+ *(manifest + 9) = (unsigned char) (((PHAR_API_VERSION) & 0xF0));
+ phar_set_32(manifest+10, global_flags);
+ phar_set_32(manifest+14, data->phar->alias_len);
/* write the manifest header */
- if (14 + data->phar->alias_len != php_stream_write(newfile, manifest, 14 + data->phar->alias_len)) {
- efree(manifest);
+ if (sizeof(manifest) != php_stream_write(newfile, manifest, sizeof(manifest))
+ || data->phar->alias_len != php_stream_write(newfile, data->phar->alias, data->phar->alias_len)) {
if (oldfile) {
php_stream_close(oldfile);
}
@@ -1875,7 +1876,6 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
phar_set_32(entry_buffer, entry->filename_len);
if (4 != php_stream_write(newfile, entry_buffer, 4)
|| entry->filename_len != php_stream_write(newfile, entry->filename, entry->filename_len)) {
- efree(manifest);
if (oldfile) {
php_stream_close(oldfile);
}
@@ -1888,16 +1888,15 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
4: creation timestamp
4: compressed filesize
4: crc32
- 1: flags (compression or not)
+ 4: flags
*/
copy = time(NULL);
phar_set_32(entry_buffer, entry->uncompressed_filesize);
phar_set_32(entry_buffer+4, copy);
phar_set_32(entry_buffer+8, entry->compressed_filesize);
phar_set_32(entry_buffer+12, entry->crc32);
- entry_buffer[16] = (char) entry->flags;
- if (17 != php_stream_write(newfile, entry_buffer, 17)) {
- efree(manifest);
+ phar_set_32(entry_buffer+16, entry->flags);
+ if (sizeof(entry_buffer) != php_stream_write(newfile, entry_buffer, sizeof(entry_buffer))) {
if (oldfile) {
php_stream_close(oldfile);
}
@@ -1924,7 +1923,6 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
file = entry->temp_file;
} else {
if (-1 == php_stream_seek(oldfile, entry->offset_within_phar + data->phar->internal_file_start, SEEK_SET)) {
- efree(manifest);
if (oldfile) {
php_stream_close(oldfile);
}
@@ -1939,7 +1937,6 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
entry->offset_within_phar = offset;
offset += entry->compressed_filesize;
if (entry->compressed_filesize != php_stream_copy_to_stream(file, newfile, entry->compressed_filesize)) {
- efree(manifest);
if (oldfile) {
php_stream_close(oldfile);
}
@@ -2007,7 +2004,6 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
php_stream_rewind(newfile);
file = php_stream_open_wrapper(data->phar->fname, "wb", IGNORE_URL|STREAM_MUST_SEEK|REPORT_ERRORS, NULL);
if (!file) {
- efree(manifest);
if (oldfile) {
php_stream_close(oldfile);
}
@@ -2018,7 +2014,6 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
php_stream_copy_to_stream(newfile, file, PHP_STREAM_COPY_ALL);
php_stream_close(newfile);
php_stream_close(file);
- efree(manifest);
file = php_stream_open_wrapper(data->phar->fname, "rb", IGNORE_URL|STREAM_MUST_SEEK|REPORT_ERRORS, NULL);
@@ -2164,11 +2159,13 @@ static void phar_dostat(phar_archive_data *phar, phar_entry_info *data, php_stre
*/
static int phar_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) /* {{{ */
{
- phar_entry_data *data;
+ phar_entry_data *data = (phar_entry_data *)stream->abstract;
+
/* If ssb is NULL then someone is misbehaving */
- if (!ssb) return -1;
+ if (!ssb) {
+ return -1;
+ }
- data = (phar_entry_data *)stream->abstract;
phar_dostat(data->phar, data->internal_file, ssb, 0, data->phar->alias, data->phar->alias_len TSRMLS_CC);
return 0;
}
@@ -2179,11 +2176,13 @@ static int phar_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D
*/
static int phar_dir_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) /* {{{ */
{
- phar_entry_data *data;
+ phar_entry_data *data = (phar_entry_data *)stream->abstract;
+
/* If ssb is NULL then someone is misbehaving */
- if (!ssb) return -1;
+ if (!ssb) {
+ return -1;
+ }
- data = (phar_entry_data *)stream->abstract;
phar_dostat(data->phar, data->internal_file, ssb, 0, data->phar->alias, data->phar->alias_len TSRMLS_CC);
return 0;
}
diff --git a/ext/phar/tests/009.phpt b/ext/phar/tests/009.phpt
index b2c9fd7f85..d594e88f4f 100644
--- a/ext/phar/tests/009.phpt
+++ b/ext/phar/tests/009.phpt
@@ -9,7 +9,7 @@ phar.require_hash=0
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
-$file .= pack('VVnV', 500, 500, 0x0800, 0) . str_repeat('A', 500);
+$file .= pack('VVnVV', 500, 500, 0x0900, 0x00000000, 0) . str_repeat('A', 500);
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
?>
diff --git a/ext/phar/tests/010.phpt b/ext/phar/tests/010.phpt
index b675180c8e..008bdc8fee 100644
--- a/ext/phar/tests/010.phpt
+++ b/ext/phar/tests/010.phpt
@@ -12,8 +12,8 @@ __HALT_COMPILER(); ?>";
// this fails because the manifest length does not include the other 10 byte manifest data
-$manifest = pack('V', 1) . 'a' . pack('VVVVC', 0, time(), 0, crc32(''), 0);
-$file .= pack('VVnV', strlen($manifest), 1, 0x0800, 3) . 'hio' . $manifest;
+$manifest = pack('V', 1) . 'a' . pack('VVVVV', 0, time(), 0, crc32(''), 0x00000000);
+$file .= pack('VVnVV', strlen($manifest), 1, 0x0900, 0x00000000, 3) . 'hio' . $manifest;
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
diff --git a/ext/phar/tests/011.phpt b/ext/phar/tests/011.phpt
index 7c7ca1da06..1ff2a32f97 100644
--- a/ext/phar/tests/011.phpt
+++ b/ext/phar/tests/011.phpt
@@ -17,10 +17,10 @@ $files['a'] = 'a';
$manifest = '';
foreach($files as $name => $cont) {
$len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len+1, crc32($cont), 0);
+ $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', $len, time(), $len+1, crc32($cont), 0x00000000);
}
$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
+$manifest = pack('VnVV', count($files), 0x0900, 0x00000000, strlen($alias)) . $alias . $manifest;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
diff --git a/ext/phar/tests/012.phpt b/ext/phar/tests/012.phpt
index 529f520358..f090f2ff12 100644
--- a/ext/phar/tests/012.phpt
+++ b/ext/phar/tests/012.phpt
@@ -6,27 +6,17 @@ Phar::mapPhar valid file
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'a';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0);
-}
-$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+include 'phar_test.inc';
+include $fname;
echo file_get_contents('phar://hio/a');
?>
--CLEAN--
diff --git a/ext/phar/tests/013.phpt b/ext/phar/tests/013.phpt
index f5eab61655..3327e53db9 100644
--- a/ext/phar/tests/013.phpt
+++ b/ext/phar/tests/013.phpt
@@ -6,6 +6,8 @@ Phar::mapPhar filesize mismatch
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
@@ -16,10 +18,10 @@ $files['a'] = 'a';
$manifest = '';
foreach($files as $name => $cont) {
$len = strlen($cont)+1;
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0);
+ $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', $len, time(), $len, crc32($cont), 0x00000000);
}
$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
+$manifest = pack('VnVV', count($files), 0x0900, 0x00000000, strlen($alias)) . $alias . $manifest;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
diff --git a/ext/phar/tests/014.phpt b/ext/phar/tests/014.phpt
index cf414f7826..ea27faaf7e 100644
--- a/ext/phar/tests/014.phpt
+++ b/ext/phar/tests/014.phpt
@@ -16,10 +16,10 @@ $files['a'] = 'a';
$manifest = '';
foreach($files as $name => $cont) {
$len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont.'X'), 0);
+ $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', $len, time(), $len, crc32($cont.'X'), 0x00000000);
}
$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
+$manifest = pack('VnVV', count($files), 0x0900, 0x00000000, strlen($alias)) . $alias . $manifest;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
diff --git a/ext/phar/tests/015.phpt b/ext/phar/tests/015.phpt
index 14103ea0b2..32c06fdfd7 100644
--- a/ext/phar/tests/015.phpt
+++ b/ext/phar/tests/015.phpt
@@ -16,10 +16,10 @@ $files['a'] = 'a';
$manifest = '';
foreach($files as $name => $cont) {
$len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), 3, crc32($cont), 0x01);
+ $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', $len, time(), 3, crc32($cont), 0x00000001);
}
$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
+$manifest = pack('VnVV', count($files), 0x0900, 0x00000001, strlen($alias)) . $alias . $manifest;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
diff --git a/ext/phar/tests/015b.phpt b/ext/phar/tests/015b.phpt
index caf9da7d13..1a92dd8785 100755
--- a/ext/phar/tests/015b.phpt
+++ b/ext/phar/tests/015b.phpt
@@ -15,10 +15,10 @@ $files = array();
$files['a'] = array('Hello World', pack('H*', '425a6839314159265359d872012f00000157800010400000400080060490002000220686d420c988c769e8281f8bb9229c28486c39009780'));
$manifest = '';
foreach($files as $name => $cont) {
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', strlen($cont[0]), time(), strlen($cont[1]), crc32($cont[0]), 0x02);
+ $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', strlen($cont[0]), time(), strlen($cont[1]), crc32($cont[0]), 0x00000002);
}
$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
+$manifest = pack('VnVV', count($files), 0x0900, 0x00000002, strlen($alias)) . $alias . $manifest;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
diff --git a/ext/phar/tests/016.phpt b/ext/phar/tests/016.phpt
index 5f308ca614..8ffc97bc73 100644
--- a/ext/phar/tests/016.phpt
+++ b/ext/phar/tests/016.phpt
@@ -13,19 +13,19 @@ __HALT_COMPILER(); ?>";
// file length is too short
$files = array();
-$files['a'] = array('a', chr(75)/*. chr(4) . chr(0): 'a' gzdeflated */, 0x01);
-$files['b'] = array('a', chr(75)/*. chr(4) . chr(0): 'a' gzdeflated */, 0x01);
-$files['c'] = array('*', '*', 0x00);
-$files['d'] = array('a', chr(75)/*. chr(4) . chr(0): 'a' gzdeflated */, 0x01);
+$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['c'] = array('*', '*', 0x00000000);
+$files['d'] = array('a', chr(75)/*. chr(4) . chr(0): 'a' gzdeflated */, 0x00000001);
$manifest = '';
foreach($files as $name => $cont) {
$ulen = strlen($cont[0]);
$clen = strlen($cont[1]);
$manifest .= pack('V', strlen($name)) . $name
- . pack('VVVVC', $ulen, time(), $clen, crc32($cont[0]), $cont[2]);
+ . pack('VVVVV', $ulen, time(), $clen, crc32($cont[0]), $cont[2]);
}
$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
+$manifest = pack('VnVV', count($files), 0x0900, 0x00000001, strlen($alias)) . $alias . $manifest;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
diff --git a/ext/phar/tests/016b.phpt b/ext/phar/tests/016b.phpt
index 2f5d3beaee..322ec4ea50 100755
--- a/ext/phar/tests/016b.phpt
+++ b/ext/phar/tests/016b.phpt
@@ -17,10 +17,10 @@ $files['a'] = 'a';
$manifest = '';
foreach($files as $name => $cont) {
$len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), 1, crc32($cont), 0x01);
+ $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', $len, time(), 1, crc32($cont), 0x00000001);
}
$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
+$manifest = pack('VnVV', count($files), 0x0900, 0x00000001, strlen($alias)) . $alias . $manifest;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
diff --git a/ext/phar/tests/017.phpt b/ext/phar/tests/017.phpt
index 1a50759255..197649d451 100644
--- a/ext/phar/tests/017.phpt
+++ b/ext/phar/tests/017.phpt
@@ -16,10 +16,10 @@ $files['a'] = 'abc';
$manifest = '';
foreach($files as $name => $cont) {
$len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x01);
+ $manifest .= pack('V', strlen($name)) . $name . pack('VVVVV', $len, time(), $len, crc32($cont), 0x00000001);
}
$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
+$manifest = pack('VnVV', count($files), 0x0900, 0x00000001, strlen($alias)) . $alias . $manifest;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
diff --git a/ext/phar/tests/018.phpt b/ext/phar/tests/018.phpt
index 3171271b0a..e30b429171 100644
--- a/ext/phar/tests/018.phpt
+++ b/ext/phar/tests/018.phpt
@@ -6,6 +6,8 @@ Phar: opendir test, root directory
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
@@ -13,20 +15,7 @@ __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'a';
$files['b/a'] = 'b';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= chr(0) . chr(4) . chr(0); // 'a' gzdeflated
-}
-
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
+include 'phar_test.inc';
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$dir = opendir('phar://hio/');
while (false !== ($a = readdir($dir))) {
diff --git a/ext/phar/tests/019.phpt b/ext/phar/tests/019.phpt
index dcaeedb07c..818dfd7ec5 100644
--- a/ext/phar/tests/019.phpt
+++ b/ext/phar/tests/019.phpt
@@ -6,6 +6,8 @@ Phar: opendir test, subdirectory
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
@@ -15,21 +17,8 @@ $files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+include 'phar_test.inc';
+include $fname;
$dir = opendir('phar://hio/b');
while (false !== ($a = readdir($dir))) {
var_dump($a);
diff --git a/ext/phar/tests/019b.phpt b/ext/phar/tests/019b.phpt
index 95b0bd696a..f1e6455a80 100755
--- a/ext/phar/tests/019b.phpt
+++ b/ext/phar/tests/019b.phpt
@@ -6,6 +6,8 @@ Phar: opendir test, recurse into
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
@@ -15,21 +17,8 @@ $files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+include 'phar_test.inc';
+include $fname;
function dump($phar, $base)
{
diff --git a/ext/phar/tests/019c.phpt b/ext/phar/tests/019c.phpt
index be82aa7bf4..a9c4bbcf4a 100755
--- a/ext/phar/tests/019c.phpt
+++ b/ext/phar/tests/019c.phpt
@@ -6,6 +6,8 @@ Phar: opendir test, recurse into
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
@@ -15,21 +17,8 @@ $files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+include 'phar_test.inc';
+include $fname;
function dump($phar, $base)
{
diff --git a/ext/phar/tests/020.phpt b/ext/phar/tests/020.phpt
index 15c55a7c85..ca0d92e0c7 100644
--- a/ext/phar/tests/020.phpt
+++ b/ext/phar/tests/020.phpt
@@ -6,30 +6,21 @@ Phar: url stat
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
+$pfile = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$files = array();
$files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
+include 'phar_test.inc';
+include $fname;
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
var_dump(stat('phar://hio/a'), stat('phar://hio/b'));
?>
--CLEAN--
diff --git a/ext/phar/tests/021.phpt b/ext/phar/tests/021.phpt
index 7ff9e1b9f9..e7844d0000 100644
--- a/ext/phar/tests/021.phpt
+++ b/ext/phar/tests/021.phpt
@@ -6,6 +6,8 @@ Phar: stream stat
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
@@ -15,21 +17,11 @@ $files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+include 'phar_test.inc';
+
+include $fname;
+
$fp = fopen('phar://hio/a', 'r');
var_dump(fstat($fp));
fclose($fp);
diff --git a/ext/phar/tests/022.phpt b/ext/phar/tests/022.phpt
index ae8b849965..70210e1cc7 100644
--- a/ext/phar/tests/022.phpt
+++ b/ext/phar/tests/022.phpt
@@ -6,27 +6,19 @@ Phar: stream stat
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'abcdefg';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+include 'phar_test.inc';
+
+include $fname;
+
$fp = fopen('phar://hio/a', 'r');
var_dump(ftell($fp));
echo 'fseek($fp, 1)';var_dump(fseek($fp, 1));
diff --git a/ext/phar/tests/023.phpt b/ext/phar/tests/023.phpt
index c7a21184c2..a6d674af45 100755
--- a/ext/phar/tests/023.phpt
+++ b/ext/phar/tests/023.phpt
@@ -6,30 +6,20 @@ Phar: phar:// file_get_contents
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
+include 'phar_test.inc';
-var_dump(file_get_contents('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php'));
-var_dump(file_get_contents('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b.php'));
-var_dump(file_get_contents('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php'));
+var_dump(file_get_contents($pname . '/a.php'));
+var_dump(file_get_contents($pname . '/b.php'));
+var_dump(file_get_contents($pname . '/b/c.php'));
?>
===DONE===
diff --git a/ext/phar/tests/024.phpt b/ext/phar/tests/024.phpt
index 97460669c1..29cd595c61 100755
--- a/ext/phar/tests/024.phpt
+++ b/ext/phar/tests/024.phpt
@@ -6,30 +6,20 @@ Phar: phar:// include
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
+include 'phar_test.inc';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
+include $pname . '/a.php';
+include $pname . '/b.php';
+include $pname . '/b/c.php';
?>
===DONE===
diff --git a/ext/phar/tests/025.phpt b/ext/phar/tests/025.phpt
index a591d59fee..b85c85b470 100755
--- a/ext/phar/tests/025.phpt
+++ b/ext/phar/tests/025.phpt
@@ -6,30 +6,20 @@ Phar: phar:// include (repeated names)
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = '<?php echo "This is a\n"; ?>';
$files['b'] = '<?php echo "This is b\n"; ?>';
$files['b/b'] = '<?php echo "This is b/b\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
+include 'phar_test.inc';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/b';
+include $pname . '/a';
+include $pname . '/b';
+include $pname . '/b/b';
?>
===DONE===
diff --git a/ext/phar/tests/026.phpt b/ext/phar/tests/026.phpt
index 7eb2f90b67..606fa40ee0 100755
--- a/ext/phar/tests/026.phpt
+++ b/ext/phar/tests/026.phpt
@@ -17,20 +17,7 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; require "'.$pname.'/b/d.php"; ?
$files['b/d.php'] = '<?php echo "This is b/d\n"; require "'.$pname.'/e.php"; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-
-file_put_contents($fname, $file);
+include 'phar_test.inc';
require $pname . '/a.php';
diff --git a/ext/phar/tests/027.phpt b/ext/phar/tests/027.phpt
index 2640e2b453..7dc7913ccd 100755
--- a/ext/phar/tests/027.phpt
+++ b/ext/phar/tests/027.phpt
@@ -17,20 +17,7 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; require "'.$pname.'/b/d.php"; ?
$files['b/d.php'] = '<?php echo "This is b/d\n"; require "'.$pname.'/e.php"; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = 'hio';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-
-file_put_contents($fname, $file);
+include 'phar_test.inc';
function dump($phar, $base)
{
diff --git a/ext/phar/tests/028.phpt b/ext/phar/tests/028.phpt
index 723192ef50..c4e4abb32f 100755
--- a/ext/phar/tests/028.phpt
+++ b/ext/phar/tests/028.phpt
@@ -7,7 +7,7 @@ phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
-$pname = 'phar://test';
+$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
@@ -17,22 +17,9 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; include "'.$pname.'/b/d.php"; ?
$files['b/d.php'] = '<?php echo "This is b/d\n"; include "'.$pname.'/e.php"; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
+include 'phar_test.inc';
-file_put_contents($fname, $file);
-
-Phar::loadPhar($fname, 'test');
+Phar::loadPhar($fname, 'hio');
include $fname;
diff --git a/ext/phar/tests/029.phpt b/ext/phar/tests/029.phpt
index bd7528537a..155a9760b1 100755
--- a/ext/phar/tests/029.phpt
+++ b/ext/phar/tests/029.phpt
@@ -8,7 +8,8 @@ phar.require_hash=0
<?php
$fname1 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.php';
-$pname = 'phar://test';
+$fname = $fname1;
+$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
@@ -18,23 +19,11 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; include "'.$pname.'/b/d.php"; ?
$files['b/d.php'] = '<?php echo "This is b/d\n"; include "'.$pname.'/e.php"; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
+include 'phar_test.inc';
-file_put_contents($fname1, $file);
file_put_contents($fname2, $file);
-var_dump(Phar::loadPhar($fname1, 'test'));
+var_dump(Phar::loadPhar($fname1, 'hio'));
var_dump(Phar::loadPhar($fname1, 'copy'));
var_dump(Phar::loadPhar($fname2, 'copy'));
diff --git a/ext/phar/tests/030.phpt b/ext/phar/tests/030.phpt
index 0767e3997d..f8f9c12a26 100755
--- a/ext/phar/tests/030.phpt
+++ b/ext/phar/tests/030.phpt
@@ -17,20 +17,7 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; include "'.$pname.'/b/d.php"; ?
$files['b/d.php'] = '<?php echo "This is b/d\n"; include "'.$pname.'/e.php"; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = 'alias';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-
-file_put_contents($fname, $file);
+include 'phar_test.inc';
Phar::loadPhar($fname);
diff --git a/ext/phar/tests/delete_in_phar.phpt b/ext/phar/tests/delete_in_phar.phpt
index 1a00893cc5..f6c0c7ae15 100644
--- a/ext/phar/tests/delete_in_phar.phpt
+++ b/ext/phar/tests/delete_in_phar.phpt
@@ -7,37 +7,26 @@ phar.readonly=0
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
+include 'phar_test.inc';
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
-unlink('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php');
+include $pname . '/a.php';
+include $pname . '/b.php';
+include $pname . '/b/c.php';
+unlink($pname . '/b/c.php');
?>
===AFTER===
<?php
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
+include $pname . '/a.php';
+include $pname . '/b.php';
+include $pname . '/b/c.php';
?>
===DONE===
diff --git a/ext/phar/tests/delete_in_phar_b.phpt b/ext/phar/tests/delete_in_phar_b.phpt
index ba18174bbf..c967644d99 100755
--- a/ext/phar/tests/delete_in_phar_b.phpt
+++ b/ext/phar/tests/delete_in_phar_b.phpt
@@ -7,37 +7,26 @@ phar.readonly=1
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
+include 'phar_test.inc';
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
-unlink('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php');
+include $pname . '/a.php';
+include $pname . '/b.php';
+include $pname . '/b/c.php';
+unlink($pname . '/b/c.php');
?>
===AFTER===
<?php
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
+include $pname . '/a.php';
+include $pname . '/b.php';
+include $pname . '/b/c.php';
?>
===DONE===
diff --git a/ext/phar/tests/delete_in_phar_confirm.phpt b/ext/phar/tests/delete_in_phar_confirm.phpt
index 69a802fad2..ada9bebeb5 100644
--- a/ext/phar/tests/delete_in_phar_confirm.phpt
+++ b/ext/phar/tests/delete_in_phar_confirm.phpt
@@ -7,34 +7,23 @@ phar.readonly=0
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
+include 'phar_test.inc';
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
-$md5 = md5_file(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php');
-unlink('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php');
+include $pname . '/a.php';
+include $pname . '/b.php';
+include $pname . '/b/c.php';
+$md5 = md5_file($fname);
+unlink($pname . '/b/c.php');
clearstatcache();
-$md52 = md5_file(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php');
+$md52 = md5_file($fname);
if ($md5 == $md52) echo 'file was not modified';
?>
===AFTER===
diff --git a/ext/phar/tests/open_for_write_existing.phpt b/ext/phar/tests/open_for_write_existing.phpt
index 93a1539e93..a1ab33a6b7 100644
--- a/ext/phar/tests/open_for_write_existing.phpt
+++ b/ext/phar/tests/open_for_write_existing.phpt
@@ -7,31 +7,20 @@ phar.readonly=0
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
+include 'phar_test.inc';
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-
-$fp = fopen('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php', 'wb');
+$fp = fopen($pname . '/b/c.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
+include $pname . '/b/c.php';
?>
===DONE===
diff --git a/ext/phar/tests/open_for_write_existing_b.phpt b/ext/phar/tests/open_for_write_existing_b.phpt
index 26631f4864..552d31ef30 100755
--- a/ext/phar/tests/open_for_write_existing_b.phpt
+++ b/ext/phar/tests/open_for_write_existing_b.phpt
@@ -7,31 +7,20 @@ phar.readonly=1
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
+include 'phar_test.inc';
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-
-$fp = fopen('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php', 'wb');
+$fp = fopen($pname . '/b/c.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
+include $pname . '/b/c.php';
?>
===DONE===
--CLEAN--
diff --git a/ext/phar/tests/open_for_write_newfile.phpt b/ext/phar/tests/open_for_write_newfile.phpt
index 5d6922945c..0594103f17 100644
--- a/ext/phar/tests/open_for_write_newfile.phpt
+++ b/ext/phar/tests/open_for_write_newfile.phpt
@@ -7,32 +7,21 @@ phar.readonly=0
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
+include 'phar_test.inc';
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-
-$fp = fopen('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/new.php', 'wb');
+$fp = fopen($pname . '/b/new.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/new.php';
+include $pname . '/b/c.php';
+include $pname . '/b/new.php';
?>
===DONE===
diff --git a/ext/phar/tests/open_for_write_newfile_b.phpt b/ext/phar/tests/open_for_write_newfile_b.phpt
index 993b67e0d8..ce91f378f6 100755
--- a/ext/phar/tests/open_for_write_newfile_b.phpt
+++ b/ext/phar/tests/open_for_write_newfile_b.phpt
@@ -7,32 +7,21 @@ phar.readonly=1
phar.require_hash=0
--FILE--
<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
+$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, time(), $len, crc32($cont), 0x00);
-}
-$alias = '';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-
-file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
-
-$fp = fopen('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/new.php', 'wb');
+include 'phar_test.inc';
+
+$fp = fopen($pname . '/b/new.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
-include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/new.php';
+include $pname . '/b/c.php';
+include $pname . '/b/new.php';
?>
===DONE===
diff --git a/ext/phar/tests/phar_oo_001.phpt b/ext/phar/tests/phar_oo_001.phpt
index 90cf3e991d..ee006e83e2 100755
--- a/ext/phar/tests/phar_oo_001.phpt
+++ b/ext/phar/tests/phar_oo_001.phpt
@@ -38,7 +38,7 @@ unlink(dirname(__FILE__) . '/phar_oo_test.phar.php');
__halt_compiler();
?>
--EXPECT--
-string(5) "0.8.0"
+string(5) "0.9.0"
int(5)
string(49) "Cannot call method on an uninitialzed Phar object"
===DONE===
diff --git a/ext/phar/tests/phar_oo_test.inc b/ext/phar/tests/phar_oo_test.inc
index 164264f556..9863e8da93 100755
--- a/ext/phar/tests/phar_oo_test.inc
+++ b/ext/phar/tests/phar_oo_test.inc
@@ -43,19 +43,7 @@ EOF;
break;
}
-$manifest = '';
-foreach($files as $name => $cont) {
- $len = strlen($cont);
- $manifest .= pack('V', strlen($name)) . $name . pack('VVVVC', $len, mktime (12, 0, 0, 3, 1, 2006), $len, crc32($cont), 0x00);
-}
-$alias = 'alias';
-$manifest = pack('VnV', count($files), 0x0800, strlen($alias)) . $alias . $manifest;
-$file .= pack('V', strlen($manifest)) . $manifest;
-foreach($files as $cont)
-{
- $file .= $cont;
-}
-
-file_put_contents($fname, $file);
+$ftime = mktime(12, 0, 0, 3, 1, 2006);
+include 'phar_test.inc';
?> \ No newline at end of file
diff --git a/ext/phar/tests/phar_test.inc b/ext/phar/tests/phar_test.inc
new file mode 100755
index 0000000000..2ead4d4dbd
--- /dev/null
+++ b/ext/phar/tests/phar_test.inc
@@ -0,0 +1,23 @@
+<?php
+
+$manifest = '';
+
+foreach($files as $name => $cont)
+{
+ $ulen = strlen($cont);
+ $clen = $ulen;
+ $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), 0x00000000);
+}
+$alias = 'hio';
+$manifest = pack('VnVV', count($files), 0x0900, 0x00000000, strlen($alias)) . $alias . $manifest;
+$file .= pack('V', strlen($manifest)) . $manifest;
+foreach($files as $cont)
+{
+ $file .= $cont;
+}
+
+file_put_contents($fname, $file);
+
+?> \ No newline at end of file