]> granicus.if.org Git - php/commitdiff
- Add initial hash support write/read/verify md5/sha1(default)
authorMarcus Boerger <helly@php.net>
Mon, 8 Jan 2007 23:03:41 +0000 (23:03 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 8 Jan 2007 23:03:41 +0000 (23:03 +0000)
53 files changed:
ext/phar/phar.c
ext/phar/tests/009.phpt
ext/phar/tests/010.phpt
ext/phar/tests/011.phpt
ext/phar/tests/012.phpt
ext/phar/tests/013.phpt
ext/phar/tests/014.phpt
ext/phar/tests/015.phpt
ext/phar/tests/015b.phpt
ext/phar/tests/016.phpt
ext/phar/tests/016b.phpt
ext/phar/tests/017.phpt
ext/phar/tests/018.phpt
ext/phar/tests/019.phpt
ext/phar/tests/019b.phpt
ext/phar/tests/019c.phpt
ext/phar/tests/020.phpt
ext/phar/tests/021.phpt
ext/phar/tests/022.phpt
ext/phar/tests/023.phpt
ext/phar/tests/024.phpt
ext/phar/tests/025.phpt
ext/phar/tests/026.phpt
ext/phar/tests/027.phpt
ext/phar/tests/028.phpt
ext/phar/tests/029.phpt
ext/phar/tests/030.phpt
ext/phar/tests/031.phpt
ext/phar/tests/032.phpt [new file with mode: 0755]
ext/phar/tests/create_new_phar.phpt
ext/phar/tests/create_new_phar_b.phpt
ext/phar/tests/delete_in_phar.phpt
ext/phar/tests/delete_in_phar_b.phpt
ext/phar/tests/delete_in_phar_confirm.phpt
ext/phar/tests/open_for_write_existing.phpt
ext/phar/tests/open_for_write_existing_b.phpt
ext/phar/tests/open_for_write_newfile.phpt
ext/phar/tests/open_for_write_newfile_b.phpt
ext/phar/tests/phar_oo_001.phpt
ext/phar/tests/phar_oo_002.phpt
ext/phar/tests/phar_oo_003.phpt
ext/phar/tests/phar_oo_004.phpt
ext/phar/tests/phar_oo_005.phpt
ext/phar/tests/phar_oo_006.phpt
ext/phar/tests/phar_oo_007.phpt
ext/phar/tests/phar_oo_008.phpt
ext/phar/tests/phar_oo_009.phpt
ext/phar/tests/phar_oo_010.phpt
ext/phar/tests/phar_oo_011.phpt
ext/phar/tests/phar_oo_011b.phpt
ext/phar/tests/phar_oo_012.phpt
ext/phar/tests/phar_oo_012_confirm.phpt
ext/phar/tests/phar_oo_012b.phpt

index 7d0022d986fc9dc3f2909c7b92e0b8b6729a1379..9400481294ddfef2105f0cd41f87ff61cae10254 100644 (file)
@@ -29,6 +29,8 @@
 #include "ext/standard/info.h"
 #include "ext/standard/url.h"
 #include "ext/standard/crc32.h"
+#include "ext/standard/md5.h"
+#include "ext/standard/sha1.h"
 #include "ext/spl/spl_array.h"
 #include "ext/spl/spl_directory.h"
 #include "ext/spl/spl_engine.h"
 #define PHAR_HDR_ANY_COMPRESSED   0x0001
 #define PHAR_HDR_SIGNATURE        0x0008
 
+#define PHAR_SIG_MD5              0x0001
+#define PHAR_SIG_SHA1             0x0002
+#define PHAR_SIG_PGP              0x0010
+
+#define PHAR_SIG_USE  PHAR_SIG_SHA1
+
 /* flags byte for each file adheres to these bitmasks.
    All unused values are reserved */
 #define PHAR_ENT_COMPRESSION_MASK 0x0F
@@ -82,12 +90,14 @@ ZEND_BEGIN_MODULE_GLOBALS(phar)
        HashTable   phar_fname_map;
        HashTable   phar_alias_map;
        int         readonly;
+       int         require_hash;
 ZEND_END_MODULE_GLOBALS(phar)
 
 ZEND_DECLARE_MODULE_GLOBALS(phar)
 
 PHP_INI_BEGIN()
-       STD_PHP_INI_BOOLEAN("phar.readonly", "1", PHP_INI_SYSTEM, OnUpdateBool, readonly, zend_phar_globals, phar_globals)
+       STD_PHP_INI_BOOLEAN("phar.readonly",     "1", PHP_INI_SYSTEM, OnUpdateBool, readonly,     zend_phar_globals, phar_globals)
+       STD_PHP_INI_BOOLEAN("phar.require_hash", "1", PHP_INI_SYSTEM, OnUpdateBool, require_hash, zend_phar_globals, phar_globals)
 PHP_INI_END()
 
 #ifndef php_uint16
@@ -591,9 +601,103 @@ static int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alia
                efree(savebuf);
                return FAILURE;
        }
+
        /* 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) {
+               unsigned char buf[1024];
+               int read_size, len;
+               php_uint32 sig_flags;
+               char sig_buf[8], *sig_ptr = sig_buf;
+               off_t read_len;
+
+               if (-1 == php_stream_seek(fp, -8, SEEK_END)
+               || (read_len = php_stream_tell(fp)) < 20
+               || 8 != php_stream_read(fp, sig_buf, 8) 
+               || memcmp(sig_buf+4, "GBMB", 4)) {
+                       php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "phar \"%s\" has a broken signature", fname);
+                       efree(savebuf);
+                       return FAILURE;
+               }
+               PHAR_GET_32(sig_ptr, sig_flags);
+               switch(sig_flags) {
+               case PHAR_SIG_SHA1: {
+                       unsigned char digest[20], saved[20];
+                       PHP_SHA1_CTX  context;
+
+                       php_stream_rewind(fp);
+                       PHP_SHA1Init(&context);
+                       read_len -= sizeof(digest);
+                       if (read_len > sizeof(buf)) {
+                               read_size = sizeof(buf);
+                       } else {
+                               read_size = (int)read_len;
+                       }
+                       while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) {
+                               PHP_SHA1Update(&context, buf, len);
+                               read_len -= (off_t)len;
+                               if (read_len < read_size) {
+                                       read_size = (int)read_len;
+                               }
+                       }
+                       PHP_SHA1Final(digest, &context);
+
+                       if (read_len > 0
+                       || php_stream_read(fp, (char*)saved, sizeof(saved)) != sizeof(saved)
+                       || memcmp(digest, saved, sizeof(digest))) {
+                               php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "phar \"%s\" has a broken signature", fname);
+                               efree(savebuf);
+                               return FAILURE;
+                       }
+
+                       break;
+               }
+               case PHAR_SIG_MD5: {
+                       unsigned char digest[16], saved[16];
+                       PHP_MD5_CTX   context;
+
+                       php_stream_rewind(fp);
+                       PHP_MD5Init(&context);
+                       read_len -= sizeof(digest);
+                       if (read_len > sizeof(buf)) {
+                               read_size = sizeof(buf);
+                       } else {
+                               read_size = (int)read_len;
+                       }
+                       while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) {
+                               PHP_MD5Update(&context, buf, len);
+                               read_len -= (off_t)len;
+                               if (read_len < read_size) {
+                                       read_size = (int)read_len;
+                               }
+                       }
+                       PHP_MD5Final(digest, &context);
+
+                       if (read_len > 0
+                       || php_stream_read(fp, (char*)saved, sizeof(saved)) != sizeof(saved)
+                       || memcmp(digest, saved, sizeof(digest))) {
+                               php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "phar \"%s\" has a broken signature", fname);
+                               efree(savebuf);
+                               return FAILURE;
+                       }
+
+                       break;
+               }
+               default:
+                       php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "phar \"%s\" has a broken signature", fname);
+                       efree(savebuf);
+                       return FAILURE;
+               }
+       } else if (PHAR_G(require_hash)) {
+               php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "phar \"%s\" does not have a signature", fname);
+               efree(savebuf);
+               return FAILURE;
+       }
 
+/*xxx*/
+#define PHAR_SIG_MD5              0x0001
+#define PHAR_SIG_SHA1             0x0002
+#define PHAR_SIG_PGP              0x0010
        /* extract alias */
        PHAR_GET_32(buffer, tmp_len);
        if (buffer + tmp_len > endbuffer) {
@@ -1511,7 +1615,7 @@ static inline void phar_set_16(char *buffer, int var) /* {{{ */
 static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
 {
        phar_entry_info *entry;
-       int alias_len, fname_len, halt_offset, restore_alias_len;
+       int alias_len, fname_len, halt_offset, restore_alias_len, global_flags = 0;
        char *buffer, *fname, *alias;
        char *manifest;
        off_t manifest_ftell, bufsize;
@@ -1670,6 +1774,7 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
                        file = entry->temp_file;
                        entry->compressed_filesize = copy;
                        entry->flags |= PHAR_ENT_MODIFIED;
+                       global_flags |= PHAR_HDR_ANY_COMPRESSED;
                }
        }
        php_stream_close(compressedfile);
@@ -1693,8 +1798,11 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
                phar_set_32(manifest+10, 0);
                data->phar->alias_len = 0;
        }
+
+       global_flags |= PHAR_HDR_SIGNATURE;
+
        *(manifest + 8) = (unsigned char) (((PHAR_API_VERSION) >> 8) & 0xFF);
-       *(manifest + 9) = (unsigned char) ((PHAR_API_VERSION) & 0xFF);
+       *(manifest + 9) = (unsigned char) (((PHAR_API_VERSION) & 0xF0) | (global_flags & 0x0F));
 
        /* write the manifest header */
        if (14 + data->phar->alias_len != php_stream_write(newfile, manifest, 14 + data->phar->alias_len)) {
@@ -1823,6 +1931,50 @@ static int phar_flush(phar_entry_data *data TSRMLS_DC) /* {{{ */
                }
        }
 
+       /* append signature */
+       if (global_flags & PHAR_HDR_SIGNATURE) {
+               unsigned char buf[1024];
+               int  sig_flags = 0, len;
+               char sig_buf[4];
+
+               php_stream_rewind(newfile);
+               
+               switch(PHAR_SIG_USE) {
+               case PHAR_SIG_PGP:
+                       /* TODO: currently fall back to sha1,later do both */
+               default:
+               case PHAR_SIG_SHA1: {
+                       unsigned char digest[20];
+                       PHP_SHA1_CTX  context;
+
+                       PHP_SHA1Init(&context);
+                       while ((len = php_stream_read(newfile, (char*)buf, sizeof(buf))) > 0) {
+                               PHP_SHA1Update(&context, buf, len);
+                       }
+                       PHP_SHA1Final(digest, &context);
+                       php_stream_write(newfile, digest, sizeof(digest));
+                       sig_flags |= PHAR_SIG_SHA1;
+                       break;
+               }
+               case PHAR_SIG_MD5: {
+                       unsigned char digest[16];
+                       PHP_MD5_CTX   context;
+
+                       PHP_MD5Init(&context);
+                       while ((len = php_stream_read(newfile, (char*)buf, sizeof(buf))) > 0) {
+                               PHP_MD5Update(&context, buf, len);
+                       }
+                       PHP_MD5Final(digest, &context);
+                       php_stream_write(newfile, digest, sizeof(digest));
+                       sig_flags |= PHAR_SIG_MD5;
+                       break;
+               }
+               }
+               phar_set_32(sig_buf, sig_flags);
+               php_stream_write(newfile, sig_buf, 4);
+               php_stream_write(newfile, "GBMB", 4);
+       }
+
        /* finally, close the temp file, rename the original phar,
           move the temp to the old phar, unlink the old phar, and reload it into memory
        */
index 7e3acabf0eb37643cea4ef4e1e0519c5c8a0f1d5..b2c9fd7f855030856f926252d16585cedd5e0f3a 100644 (file)
@@ -2,6 +2,8 @@
 Phar::mapPhar too many manifest entries
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip";?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index f22d364c7f4251c0d7574886003854502217aaea..b675180c8e7f249feba3283e09722482179a032b 100644 (file)
@@ -2,6 +2,8 @@
 Phar::mapPhar buffer overrun
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip";?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index c88d9187082f73415b95d097fb482add9479ddfd..7c7ca1da066637c384f858dee95004ea3f46c43f 100644 (file)
@@ -2,6 +2,8 @@
 Phar::mapPhar filesize too small in manifest
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip";?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index 83135586dd788052091f2249f68cf62cfa8fcde1..529f52035864efa54cd0d9c680182678b99bbce7 100644 (file)
@@ -2,6 +2,8 @@
 Phar::mapPhar valid file
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip";?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index ef966e5b2ef1b968dbf423e1832a3ebc7446425e..f5eab6165588bfd436edbbc69b93b3474cb79f6a 100644 (file)
@@ -2,6 +2,8 @@
 Phar::mapPhar filesize mismatch
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip";?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index 51b753106e2713cd06266ac943e0954590c852a9..cf414f782646dbfffd9e781e11f692f756acca7d 100644 (file)
@@ -2,6 +2,8 @@
 Phar::mapPhar filesize mismatch
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip";?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index 3e6c673691a088a278c564571d516ac5674637fc..14103ea0b27766b48b13d9bc9ec40808c7582bb6 100644 (file)
@@ -3,6 +3,8 @@ Phar::mapPhar valid file (gzipped)
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip";
 if (!extension_loaded("zlib")) print "skip zlib not present"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index 06c0d3065a929e6b1cf427495239a884477d57bc..caf9da7d137bf6eb2f2609ca5f0ecfb618182c02 100755 (executable)
@@ -3,6 +3,8 @@ Phar::mapPhar valid file (bzip2)
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip";
 if (!extension_loaded("bz2")) print "skip bz2 not present"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index 61d784474fd89fbe80c922d8ce758324236f16fe..5f308ca6144a71c51860bb9c229201d4db9f896f 100644 (file)
@@ -3,6 +3,8 @@ Phar::mapPhar invalid file (gzipped file length is too short)
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip";
 if (!extension_loaded("zlib")) print "skip zlib not present"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index da6d10800a2c159a2a62f76d65e9a0f625df5c86..2f5d3beaee7c9c475e1bda633c385c46254e38fa 100755 (executable)
@@ -3,6 +3,8 @@ Phar::mapPhar invalid file (gzipped file length is too short)
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip";
 if (!extension_loaded("zlib")) print "skip zlib not present"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index 3f67df4885afd6d9dfca9ec5490c1dd8b45f1cff..1a50759255d480e4aa376a4284ca97909a29f1e5 100644 (file)
@@ -2,6 +2,8 @@
 Phar: opendir test - no dir specified at all
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index 83c733437ac317b9acafaa5a07a6314e1cb3df5f..3171271b0aab76711420fa39b82b088b43dd7ccb 100644 (file)
@@ -2,6 +2,8 @@
 Phar: opendir test, root directory
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index 0e608a2ce874a154fc6dff5789bacb5f27e78c0d..dcaeedb07c297c7ab1951b36163dec665d5789b1 100644 (file)
@@ -2,6 +2,8 @@
 Phar: opendir test, subdirectory
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index f7b605f52cea578fb0c221961e0f334eddc3c193..95b0bd696a1c62c837f6d16959626bee827c1290 100755 (executable)
@@ -2,6 +2,8 @@
 Phar: opendir test, recurse into
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index c9f98efdf80b2928d1a737c7f7ec9ed89f378a05..be82aa7bf43a56ac2fa1a749217de1af3215eccf 100755 (executable)
@@ -2,6 +2,8 @@
 Phar: opendir test, recurse into
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index a9cbbca7b2f7a6734d1895efcb0c3a09418e6393..15c55a7c8563533b00c8dc9eba220d6b42a49cc7 100644 (file)
@@ -2,6 +2,8 @@
 Phar: url stat
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index 810a45a8770f87580b1b7a267c7ab20d28f2c74b..7ff9e1b9f9db819e7c11a9ee552532c336ff7172 100644 (file)
@@ -2,6 +2,8 @@
 Phar: stream stat
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index 5835640fa3b31f63af7bbad664e300fdca031dff..ae8b8499652c64d2ee886f9550c45a34c53927cc 100644 (file)
@@ -2,6 +2,8 @@
 Phar: stream stat
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php
index 6104c8719d6fac9f4b5fa620c82891e3c4d52c8b..c7a21184c2ab3ddcbf9e1e6086543f3a939b93e9 100755 (executable)
@@ -2,6 +2,8 @@
 Phar: phar:// file_get_contents
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php __HALT_COMPILER(); ?>";
index 243e70c6c869c729a81024ccfec36f6caaea5aee..97460669c1460bc8888f50c0de647c91a461c2e6 100755 (executable)
@@ -2,6 +2,8 @@
 Phar: phar:// include
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php __HALT_COMPILER(); ?>";
index bf66256bdc927776e08592ac9c45ecb7d6d0760f..a591d59fee27754ca7b4d4553b3488392bb43631 100755 (executable)
@@ -2,6 +2,8 @@
 Phar: phar:// include (repeated names)
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php __HALT_COMPILER(); ?>";
index 9737c5f1fdd7b796c8b22c7210e2684e1a21783c..7eb2f90b67ac732ae61e3e17a1b3880824d22944 100755 (executable)
@@ -2,6 +2,8 @@
 Phar: phar:// require from within
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
index 4322630b42cb27d36017721b67ac96ce8330066a..2640e2b453ec42505edf12e04fb9d1ecae7f0fb5 100755 (executable)
@@ -2,6 +2,8 @@
 Phar: phar:// opendir
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
index 331ad4a240aa1e32c519c0c4dbe0efb79f28355c..723192ef5066db2999b35dff5ecf23a3bc998436 100755 (executable)
@@ -2,6 +2,8 @@
 Phar::loadPhar
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
index 1bc9dcda35a0bac8afbae2904995f8a2b87b390d..bd7528537ad601f7f3b9ec51fb6df8286d331e44 100755 (executable)
@@ -2,6 +2,8 @@
 Phar::loadPhar overloading alias names
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $fname1 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
index 0ad1209193f3554849d708c6e4bc5fab291c6f0f..0767e3997d95dd4b25db6b00deb8663c904a0270 100755 (executable)
@@ -2,6 +2,8 @@
 Phar::loadPhar ignoring alias
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
index 94a895e37f60b7ab34adcc611112f7362fae017d..f3faa93d8e0c5fbf185ffe2dcf70a81f60d72d27 100755 (executable)
@@ -2,6 +2,8 @@
 Phar: include and parser error
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 
diff --git a/ext/phar/tests/032.phpt b/ext/phar/tests/032.phpt
new file mode 100755 (executable)
index 0000000..f8b8b97
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+Phar: require hash
+--SKIPIF--
+<?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=1
+--FILE--
+<?php
+
+$pharconfig = 0;
+
+require_once 'phar_oo_test.inc';
+
+Phar::loadPhar($fname);
+
+?>
+===DONE===
+--CLEAN--
+<?php 
+unlink(dirname(__FILE__) . '/phar_oo_test.phar.php');
+__halt_compiler();
+?>
+--EXPECTF--
+
+Catchable fatal error: Phar::loadPhar(): phar "%sphar_oo_test.phar.php" does not have a signature in %s032.php on line %d
index fe00960a74f71be57f240c81c1df63bbee4b1d18..2781f0c7bf732fbcbd90cd87e4b029735ab43bfc 100644 (file)
@@ -4,6 +4,7 @@ Phar: create a completely new phar
 <?php if (!extension_loaded("phar")) print "skip"; ?>
 --INI--
 phar.readonly=0
+phar.require_hash=1
 --FILE--
 <?php
 
index c402bba8aa617bb44244ce1d3566f838042cc5bc..74045ef4110fc9df9b872c033088cf5e6c8f32fb 100755 (executable)
@@ -4,6 +4,7 @@ Phar: create a completely new phar
 <?php if (!extension_loaded("phar")) print "skip"; ?>
 --INI--
 phar.readonly=1
+phar.require_hash=1
 --FILE--
 <?php
 
index 6fa4bf144807cd3b7d60e33c6385cfe56eff2062..1a00893cc5a79e23a42d1ea21a3008f38b6a306f 100644 (file)
@@ -4,6 +4,7 @@ Phar: delete a file within a .phar
 <?php if (!extension_loaded("phar")) print "skip"; ?>
 --INI--
 phar.readonly=0
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php __HALT_COMPILER(); ?>";
index c90dd1012029966455d0efd8e8cd01e82baed402..ba18174bbf9e1a988579de200081701116e5b37c 100755 (executable)
@@ -4,6 +4,7 @@ Phar: delete a file within a .phar
 <?php if (!extension_loaded("phar")) print "skip"; ?>
 --INI--
 phar.readonly=1
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php __HALT_COMPILER(); ?>";
index 7e8d048533258ff8ad747fd06099c3d3577426c3..69a802fad2dd7ed44ae9feffa40ea027db88fcfb 100644 (file)
@@ -4,6 +4,7 @@ Phar: delete a file within a .phar (confirm disk file is changed)
 <?php if (!extension_loaded("phar")) print "skip"; ?>
 --INI--
 phar.readonly=0
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php __HALT_COMPILER(); ?>";
index b789e941a1694a2c384312047bc3f97366b5907a..93a1539e93bd8a046ac2b85051bf7a3a20ff0618 100644 (file)
@@ -4,6 +4,7 @@ Phar: fopen a .phar for writing (existing file)
 <?php if (!extension_loaded("phar")) print "skip"; ?>
 --INI--
 phar.readonly=0
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php __HALT_COMPILER(); ?>";
index 1c3e21199f745dc1db2d1d8584a726bb3029b23d..26631f4864ee966c019a317f11bc385d4bb546cc 100755 (executable)
@@ -4,6 +4,7 @@ Phar: fopen a .phar for writing (existing file)
 <?php if (!extension_loaded("phar")) print "skip"; ?>
 --INI--
 phar.readonly=1
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php __HALT_COMPILER(); ?>";
index 585ac802404a4a2ca9e74f07853dd96b4e1cb431..5d6922945c5fd6d1d2d4b9f3ce039b4ab99f3e88 100644 (file)
@@ -4,6 +4,7 @@ Phar: fopen a .phar for writing (new file)
 <?php if (!extension_loaded("phar")) print "skip"; ?>
 --INI--
 phar.readonly=0
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php __HALT_COMPILER(); ?>";
index 0c4bd13f7df94d9d5bbf7269c28ce241fc3cf206..38618de80e3a6cea809d8a045f233c404cbb00e4 100755 (executable)
@@ -4,6 +4,7 @@ Phar: fopen a .phar for writing (new file)
 <?php if (!extension_loaded("phar")) print "skip"; ?>
 --INI--
 phar.readonly=1
+phar.require_hash=0
 --FILE--
 <?php
 $file = "<?php __HALT_COMPILER(); ?>";
index 8240969a2b6d6c58f1569a04420a4ccfe3a314a9..90cf3e991d8fd9375746d81a408a1bc289e207e4 100755 (executable)
@@ -2,6 +2,8 @@
 Phar object: basics
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 
index f937f4b9e26f3888e69a52d7ac08e5355c84ea74..ca798c958c607fcb6fab7900dd933804f789b5f8 100755 (executable)
@@ -2,6 +2,8 @@
 Phar object: iterator & entries
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 
index 838d599a0f3db8f4519aa307e70180de598f4889..c9b5098effbb78bb725545cf030fb479013db9b9 100755 (executable)
@@ -2,6 +2,8 @@
 Phar object: entry & openFile()
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 
index 561ff5f093a1c219759411ae57cbea623bad7645..5d8768ca8bb63455ca93bf05617f1ae5d2e58dba 100755 (executable)
@@ -2,6 +2,8 @@
 Phar and DirectoryIteraotr
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 
index 167bee73ad96aa076a92f588a0432aedd8de005e..6eb2ec1d5bf858842f1f9d9ad1ba13c996bc610e 100755 (executable)
@@ -2,6 +2,8 @@
 Phar and RecursiveDirectoryIterator
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 
index ec6e8f4afdec9a0e0e58310ab9d88ccee97dcc8b..6459bb9f6dd5397e17d627acfd1373356a985967 100755 (executable)
@@ -2,6 +2,8 @@
 Phar object: array access
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 
index 6a2565220a90d966ee5151c0a2bb621740fed810..48f1b90864bb09105cc97d41c3a97e4e414d26f3 100755 (executable)
@@ -2,6 +2,8 @@
 Phar object: access through SplFileObject
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 
index 8b0777ecce4eaf657e453a93ed63f9aae56f1344..6db2e8606b902dcfeaddb556f48d41f41c6f0c7b 100755 (executable)
@@ -2,6 +2,8 @@
 Phar object: iterating via SplFileObject
 --SKIPIF--
 <?php if (!extension_loaded("phar")) print "skip"; ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 
index f8f5d3d1222c35b37b02db1724d5082f91d0c129..a38b1018acb692aace066d73bd3c8b9021a7aeff 100755 (executable)
@@ -3,6 +3,8 @@ Phar object: iterating via SplFileObject and reading csv
 --SKIPIF--
 <?php if (!extension_loaded('phar')) die('skip'); ?>
 <?php if (!defined('SplFileObject::READ_CSV') || !defined('SplFileObject::SKIP_EMPTY')) die('skip newer SPL version is required'); ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 
index f1ace6a3654ab340791834295e147e07a7dccf7e..86c21017e2c86515dd276db14e14689f94aef90d 100755 (executable)
@@ -2,6 +2,8 @@
 Phar object: ArrayAccess and isset
 --SKIPIF--
 <?php if (!extension_loaded('phar')) die('skip'); ?>
+--INI--
+phar.require_hash=0
 --FILE--
 <?php
 
index fbaccb03ad7f8f80dd2c8bfc415b307fbdcfa1fa..ad9e9c4179c3db641d6c2e173682f1d3e119d049 100644 (file)
@@ -4,6 +4,7 @@ Phar object: add file
 <?php if (!extension_loaded('phar')) die('skip'); ?>
 --INI--
 phar.readonly=0
+phar.require_hash=0
 --FILE--
 <?php
 
index cc63080172c70576ab7e073c63b5fed1c9781613..9ea22246cc49dd3d9f5d24f594d745e44e5a49b1 100755 (executable)
@@ -4,6 +4,7 @@ Phar object: add file
 <?php if (!extension_loaded('phar')) die('skip'); ?>
 --INI--
 phar.readonly=1
+phar.require_hash=0
 --FILE--
 <?php
 
index 3b6f2cfe3b032247bfa924b4200de2edf2256cb9..a7b013529d0915bb0b62848f96d0b36e9d133c13 100644 (file)
@@ -4,6 +4,7 @@ Phar object: unset file
 <?php if (!extension_loaded('phar')) die('skip'); ?>
 --INI--
 phar.readonly=0
+phar.require_hash=0
 --FILE--
 <?php
 
index cd429ab775fe79401004aab5fdfa5c5585fe2f90..2c194e8afd16353c32c21c709ea198c1c04bcd07 100644 (file)
@@ -4,6 +4,7 @@ Phar object: unset file (confirm disk file is changed)
 <?php if (!extension_loaded('phar')) die('skip'); ?>
 --INI--
 phar.readonly=0
+phar.require_hash=0
 --FILE--
 <?php
 
index 574698e3fe427a9a03ca748b4de149a5b997fa75..648d8ce1986d5a1cafe548762ca2749133288896 100755 (executable)
@@ -4,6 +4,7 @@ Phar object: unset file
 <?php if (!extension_loaded('phar')) die('skip'); ?>
 --INI--
 phar.readonly=1
+phar.require_hash=0
 --FILE--
 <?php