cvs: php-src /ext/phar config.w32 dirstream.c func_interceptors.c package.php package.xml phar.c phar_internal.h phar_object.c php_phar.h stream.c
stream.h tar.c util.c zip.c /ext/phar/tests opendir_edgecases.phpt phar_buildfromiterator10.phpt phar_get_supported_signatures_001.phpt
phar_get_supported_signatures_001a.phpt phar_get_supported_signatures_002.phpt phar_get_supported_signatures_002a.phpt phpinfo_004.phpt
/ext/phar/tests/cache_list/files frontcontroller.phar.inc frontcontroller10.phar.inc frontcontroller11.phar.inc frontcontroller12.phar.inc
frontcontroller13.phar.inc frontcontroller14.phar.inc frontcontroller16.phar.inc frontcontroller17.phar.inc frontcontroller18.phar.inc
frontcontroller19.phar.inc frontcontroller2.phar.inc frontcontroller3.phar.inc frontcontroller4.phar.inc frontcontroller5.phar.inc
frontcontroller6.phar.inc frontcontroller7.phar.inc frontcontroller8.phar.inc frontcontroller9.phar.inc md5.phar nophar.phar nophar.phar.inc
openssl.phar ! openssl.phar.pubkey phar_oo_test.inc phar_test.inc private.pem sha1.phar sha256.phar sha512.phar zfapp.tgz /ext/phar/tests/zip
bzip2.phpt /ext/phar/tests/zip/files bzip2.zip

From: Date: Sun, 31 Aug 2008 20:54:28 +0000
Subject: cvs: php-src /ext/phar config.w32 dirstream.c func_interceptors.c package.php package.xml phar.c phar_internal.h phar_object.c php_phar.h stream.c
stream.h tar.c util.c zip.c /ext/phar/tests opendir_edgecases.phpt phar_buildfromiterator10.phpt phar_get_supported_signatures_001.phpt
phar_get_supported_signatures_001a.phpt phar_get_supported_signatures_002.phpt phar_get_supported_signatures_002a.phpt phpinfo_004.phpt
/ext/phar/tests/cache_list/files frontcontroller.phar.inc frontcontroller10.phar.inc frontcontroller11.phar.inc frontcontroller12.phar.inc
frontcontroller13.phar.inc frontcontroller14.phar.inc frontcontroller16.phar.inc frontcontroller17.phar.inc frontcontroller18.phar.inc
frontcontroller19.phar.inc frontcontroller2.phar.inc frontcontroller3.phar.inc frontcontroller4.phar.inc frontcontroller5.phar.inc
frontcontroller6.phar.inc frontcontroller7.phar.inc frontcontroller8.phar.inc frontcontroller9.phar.inc md5.phar nophar.phar nophar.phar.inc
openssl.phar ! openssl.phar.pubkey phar_oo_test.inc phar_test.inc private.pem sha1.phar sha256.phar sha512.phar zfapp.tgz /ext/phar/tests/zip
bzip2.phpt /ext/phar/tests/zip/files bzip2.zip
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-52857@lists.php.net to get a copy of this message
sfox Sun Aug 31 20:54:28 2008 UTC Modified files: /php-src/ext/phar config.w32 dirstream.c func_interceptors.c package.php package.xml phar.c phar_internal.h phar_object.c php_phar.h stream.c stream.h tar.c util.c zip.c /php-src/ext/phar/tests opendir_edgecases.phpt phar_buildfromiterator10.phpt phar_get_supported_signatures_001.phpt phar_get_supported_signatures_001a.phpt phar_get_supported_signatures_002.phpt phar_get_supported_signatures_002a.phpt phpinfo_004.phpt /php-src/ext/phar/tests/cache_list/files frontcontroller.phar.inc frontcontroller10.phar.inc frontcontroller11.phar.inc frontcontroller12.phar.inc frontcontroller13.phar.inc frontcontroller14.phar.inc frontcontroller16.phar.inc frontcontroller17.phar.inc frontcontroller18.phar.inc frontcontroller19.phar.inc frontcontroller2.phar.inc frontcontroller3.phar.inc frontcontroller4.phar.inc frontcontroller5.phar.inc frontcontroller6.phar.inc frontcontroller7.phar.inc frontcontroller8.phar.inc frontcontroller9.phar.inc md5.phar nophar.phar nophar.phar.inc openssl.phar openssl.phar.pubkey phar_oo_test.inc phar_test.inc private.pem sha1.phar sha256.phar sha512.phar zfapp.tgz /php-src/ext/phar/tests/zip bzip2.phpt /php-src/ext/phar/tests/zip/files bzip2.zip Log: - MFB

http://cvs.php.net/viewvc.cgi/php-src/ext/phar/config.w32?r1=1.29&r2=1.30&diff_format=u Index: php-src/ext/phar/config.w32 diff -u php-src/ext/phar/config.w32:1.29 php-src/ext/phar/config.w32:1.30 --- php-src/ext/phar/config.w32:1.29 Fri Aug 1 13:45:05 2008 +++ php-src/ext/phar/config.w32 Sun Aug 31 20:54:27 2008 @@ -1,4 +1,4 @@ -// $Id: config.w32,v 1.29 2008/08/01 13:45:05 sfox Exp $ +// $Id: config.w32,v 1.30 2008/08/31 20:54:27 sfox Exp $ // vim:ft=javascript ARG_ENABLE("phar", "enable phar support", "no"); @@ -29,9 +29,11 @@ WARNING('Could not enable native OpenSSL support in Phar'); } } else { - /* If ext/openssl is built-in we can at least use the API directly */ - if (PHP_OPENSSL != "no" && !PHP_OPENSSL_SHARED) { + if (PHP_OPENSSL != "no" && !PHP_OPENSSL_SHARED && !PHP_PHAR_SHARED) { AC_DEFINE('PHAR_HAVE_OPENSSL', 1); + STDOUT.WriteLine(' Native OpenSSL support in Phar enabled'); + } else { + STDOUT.WriteLine(' Native OpenSSL support in Phar disabled'); } } ADD_EXTENSION_DEP('phar', 'spl', true); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/dirstream.c?r1=1.31&r2=1.32&diff_format=u Index: php-src/ext/phar/dirstream.c diff -u php-src/ext/phar/dirstream.c:1.31 php-src/ext/phar/dirstream.c:1.32 --- php-src/ext/phar/dirstream.c:1.31 Fri Aug 1 13:45:05 2008 +++ php-src/ext/phar/dirstream.c Sun Aug 31 20:54:27 2008 @@ -569,7 +569,6 @@ int arch_len, entry_len; php_url *resource = NULL; uint host_len; - int key_type; phar_zstr key; char *str_key; uint key_len; @@ -641,7 +640,7 @@ } for (zend_hash_internal_pointer_reset(&phar->manifest); - HASH_KEY_NON_EXISTANT != (key_type = zend_hash_get_current_key_ex(&phar->manifest, &key, &key_len, &unused, 0, NULL)); + HASH_KEY_NON_EXISTANT != zend_hash_get_current_key_ex(&phar->manifest, &key, &key_len, &unused, 0, NULL); zend_hash_move_forward(&phar->manifest)) { PHAR_STR(key, str_key); @@ -661,7 +660,7 @@ } for (zend_hash_internal_pointer_reset(&phar->virtual_dirs); - HASH_KEY_NON_EXISTANT != (key_type = zend_hash_get_current_key_ex(&phar->virtual_dirs, &key, &key_len, &unused, 0, NULL)); + HASH_KEY_NON_EXISTANT != zend_hash_get_current_key_ex(&phar->virtual_dirs, &key, &key_len, &unused, 0, NULL); zend_hash_move_forward(&phar->virtual_dirs)) { PHAR_STR(key, str_key); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/func_interceptors.c?r1=1.25&r2=1.26&diff_format=u Index: php-src/ext/phar/func_interceptors.c diff -u php-src/ext/phar/func_interceptors.c:1.25 php-src/ext/phar/func_interceptors.c:1.26 --- php-src/ext/phar/func_interceptors.c:1.25 Thu Aug 14 13:02:13 2008 +++ php-src/ext/phar/func_interceptors.c Sun Aug 31 20:54:27 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: func_interceptors.c,v 1.25 2008/08/14 13:02:13 dmitry Exp $ */ +/* $Id: func_interceptors.c,v 1.26 2008/08/31 20:54:27 sfox Exp $ */ #include "phar_internal.h" @@ -517,7 +517,7 @@ case S_IFDIR: RETURN_STRING("dir", 1); case S_IFREG: RETURN_STRING("file", 1); } - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown file type (%d)", stat_sb->st_mode&S_IFMT); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown file type (%u)", stat_sb->st_mode & S_IFMT); RETURN_STRING("unknown", 1); case FS_IS_W: RETURN_BOOL((stat_sb->st_mode & wmask) != 0); @@ -681,16 +681,12 @@ #endif goto statme_baby; } else { - char *save, *save2, *actual; - int save_len, save2_len, actual_len; + char *save; + int save_len; notfound: save = PHAR_G(cwd); - save2 = entry; - actual = entry[0] == '/' ? (entry + 1) : entry; save_len = PHAR_G(cwd_len); - save2_len = entry_len; - actual_len = entry[0] == '/' ? (entry_len - 1) : entry_len; /* this file is not in the current directory, use the original path */ entry = estrndup(filename, filename_length); entry_len = filename_length; @@ -702,7 +698,6 @@ PHAR_G(cwd) = save; PHAR_G(cwd_len) = save_len; efree(entry); - efree(save2); if (IS_EXISTS_CHECK(type)) { efree(arch); RETURN_TRUE; @@ -713,7 +708,6 @@ PHAR_G(cwd) = save; PHAR_G(cwd_len) = save_len; efree(entry); - efree(save2); efree(arch); if (IS_EXISTS_CHECK(type)) { RETURN_TRUE; @@ -735,7 +729,6 @@ PHAR_G(cwd) = save; PHAR_G(cwd_len) = save_len; efree(entry); - efree(save2); efree(arch); /* Error Occured */ if (!IS_EXISTS_CHECK(type)) { http://cvs.php.net/viewvc.cgi/php-src/ext/phar/package.php?r1=1.40&r2=1.41&diff_format=u Index: php-src/ext/phar/package.php diff -u php-src/ext/phar/package.php:1.40 php-src/ext/phar/package.php:1.41 --- php-src/ext/phar/package.php:1.40 Fri Aug 1 13:45:05 2008 +++ php-src/ext/phar/package.php Sun Aug 31 20:54:27 2008 @@ -8,8 +8,12 @@ * phar.extract_list and Phar::getExtractList() are removed Major feature functionality release + * phar.cache_list allows web-based phar applications to run at equal or faster than + their on-disk equivalent [Greg] * new default stub allows running of phar-based phars without phar extension [Greg/Steph] * add support for tar-based and zip-based phar archives [Greg] + * add support for OpenSSL-based true signatures [Greg] + * add support for signatures to tar-based phar archives [Greg] * add Phar::isFileFormat() [Greg] * add Phar::convertToExecutable(), Phar::convertToData() [Greg] * add Phar::compress() [Greg] @@ -41,6 +45,10 @@ Changes since 2.0.0a2: many bugfixes, removal of phar.extract_list, compression API refactored, conversion API refactored +Changes since 2.0.0b1: addition of phar.cache_list, many performance improvements and bugfixes + implement OpenSSL asynchronous true package signing + add support for package signing to tar-based archives + require PHP 5.2.1+ '; if (!class_exists("Phar") && !extension_loaded("Phar")) { @@ -81,7 +89,7 @@ $package = PEAR_PackageFileManager2::importOptions(dirname(__FILE__) . '/package.xml', $options); $package->clearDeps(); -$package->setPhpDep('5.2.0'); +$package->setPhpDep('5.2.1'); $package->setPearInstallerDep('1.4.3'); $package->addPackageDepWithChannel('optional', 'bz2', 'pecl.php.net', false, false, false, false, 'bz2'); // all this false business sets the <providesextension> tag that allows us to have hash built http://cvs.php.net/viewvc.cgi/php-src/ext/phar/package.xml?r1=1.56&r2=1.57&diff_format=u Index: php-src/ext/phar/package.xml diff -u php-src/ext/phar/package.xml:1.56 php-src/ext/phar/package.xml:1.57 --- php-src/ext/phar/package.xml:1.56 Mon May 12 20:43:02 2008 +++ php-src/ext/phar/package.xml Sun Aug 31 20:54:27 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<package packagerversion="1.7.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> +<package packagerversion="1.7.2" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>phar</name> <channel>pecl.php.net</channel> <summary>allows running of complete applications out of .phar files (like Java .jar files)</summary> @@ -42,10 +42,10 @@ <email>sfox@php.net</email> <active>yes</active> </developer> - <date>2008-05-12</date> - <time>15:42:58</time> + <date>2008-08-31</date> + <time>15:34:02</time> <version> - <release>2.0.0b1</release> + <release>2.0.0RC1</release> <api>1.1.1</api> </version> <stability> @@ -62,8 +62,12 @@ * phar.extract_list and Phar::getExtractList() are removed Major feature functionality release + * phar.cache_list allows web-based phar applications to run at equal or faster than + their on-disk equivalent [Greg] * new default stub allows running of phar-based phars without phar extension [Greg/Steph] * add support for tar-based and zip-based phar archives [Greg] + * add support for OpenSSL-based true signatures [Greg] + * add support for signatures to tar-based phar archives [Greg] * add Phar::isFileFormat() [Greg] * add Phar::convertToExecutable(), Phar::convertToData() [Greg] * add Phar::compress() [Greg] @@ -95,6 +99,10 @@ Changes since 2.0.0a2: many bugfixes, removal of phar.extract_list, compression API refactored, conversion API refactored +Changes since 2.0.0b1: addition of phar.cache_list, many performance improvements and bugfixes + implement OpenSSL asynchronous true package signing + add support for package signing to tar-based archives + require PHP 5.2.1+ </notes> <contents> @@ -109,7 +117,84 @@ <file name="pharcommand.inc" role="src" /> </dir> <!-- /phar --> <dir name="tests"> + <dir name="cache_list"> + <dir name="files"> + <file name="frontcontroller.phar" role="test" /> + <file name="frontcontroller.phar.inc" role="test" /> + <file name="frontcontroller2.phar" role="test" /> + <file name="frontcontroller2.phar.inc" role="test" /> + <file name="frontcontroller3.phar" role="test" /> + <file name="frontcontroller3.phar.inc" role="test" /> + <file name="frontcontroller4.phar" role="test" /> + <file name="frontcontroller4.phar.inc" role="test" /> + <file name="frontcontroller5.phar" role="test" /> + <file name="frontcontroller5.phar.inc" role="test" /> + <file name="frontcontroller6.phar" role="test" /> + <file name="frontcontroller6.phar.inc" role="test" /> + <file name="frontcontroller7.phar" role="test" /> + <file name="frontcontroller7.phar.inc" role="test" /> + <file name="frontcontroller8.phar" role="test" /> + <file name="frontcontroller8.phar.inc" role="test" /> + <file name="frontcontroller9.phar" role="test" /> + <file name="frontcontroller9.phar.inc" role="test" /> + <file name="frontcontroller10.phar" role="test" /> + <file name="frontcontroller10.phar.inc" role="test" /> + <file name="frontcontroller11.phar" role="test" /> + <file name="frontcontroller11.phar.inc" role="test" /> + <file name="frontcontroller12.phar" role="test" /> + <file name="frontcontroller12.phar.inc" role="test" /> + <file name="frontcontroller13.phar" role="test" /> + <file name="frontcontroller13.phar.inc" role="test" /> + <file name="frontcontroller14.phar" role="test" /> + <file name="frontcontroller14.phar.inc" role="test" /> + <file name="frontcontroller16.phar" role="test" /> + <file name="frontcontroller16.phar.inc" role="test" /> + <file name="frontcontroller17.phar" role="test" /> + <file name="frontcontroller17.phar.inc" role="test" /> + <file name="frontcontroller18.phar" role="test" /> + <file name="frontcontroller18.phar.inc" role="test" /> + <file name="frontcontroller19.phar" role="test" /> + <file name="frontcontroller19.phar.inc" role="test" /> + </dir> <!-- /tests/cache_list/files --> + <file name="frontcontroller1.phpt" role="test" /> + <file name="frontcontroller2.phpt" role="test" /> + <file name="frontcontroller3.phpt" role="test" /> + <file name="frontcontroller4.phpt" role="test" /> + <file name="frontcontroller5.phpt" role="test" /> + <file name="frontcontroller6.phpt" role="test" /> + <file name="frontcontroller7.phpt" role="test" /> + <file name="frontcontroller8.phpt" role="test" /> + <file name="frontcontroller9.phpt" role="test" /> + <file name="frontcontroller10.phpt" role="test" /> + <file name="frontcontroller11.phpt" role="test" /> + <file name="frontcontroller12.phpt" role="test" /> + <file name="frontcontroller13.phpt" role="test" /> + <file name="frontcontroller14.phpt" role="test" /> + <file name="frontcontroller15.phpt" role="test" /> + <file name="frontcontroller16.phpt" role="test" /> + <file name="frontcontroller17.phpt" role="test" /> + <file name="frontcontroller18.phpt" role="test" /> + <file name="frontcontroller19.phpt" role="test" /> + <file name="frontcontroller20.phpt" role="test" /> + <file name="frontcontroller21.phpt" role="test" /> + <file name="frontcontroller22.phpt" role="test" /> + <file name="frontcontroller23.phpt" role="test" /> + <file name="frontcontroller24.phpt" role="test" /> + <file name="frontcontroller25.phpt" role="test" /> + <file name="frontcontroller26.phpt" role="test" /> + <file name="frontcontroller27.phpt" role="test" /> + <file name="frontcontroller28.phpt" role="test" /> + <file name="frontcontroller29.phpt" role="test" /> + <file name="frontcontroller30.phpt" role="test" /> + <file name="frontcontroller31.phpt" role="test" /> + <file name="frontcontroller32.phpt" role="test" /> + <file name="frontcontroller33.phpt" role="test" /> + <file name="frontcontroller34.phpt" role="test" /> + </dir> <!-- /tests/cache_list --> <dir name="files"> + <file name="blog.phar" role="test" /> + <file name="blog.phar.inc" role="test" /> + <file name="config.xml" role="test" /> <file name="extracted.inc" role="test" /> <file name="frontcontroller.phar" role="test" /> <file name="frontcontroller.phar.inc" role="test" /> @@ -150,8 +235,12 @@ <file name="md5.phar" role="test" /> <file name="nophar.phar" role="test" /> <file name="nophar.phar.inc" role="test" /> + <file name="notbogus.zip" role="test" /> + <file name="openssl.phar" role="test" /> + <file name="openssl.phar.pubkey" role="test" /> <file name="phar_oo_test.inc" role="test" /> <file name="phar_test.inc" role="test" /> + <file name="private.pem" role="test" /> <file name="sha1.phar" role="test" /> <file name="sha256.phar" role="test" /> <file name="sha512.phar" role="test" /> @@ -200,6 +289,8 @@ <file name="033.phpt" role="test" /> <file name="033a.phpt" role="test" /> <file name="alias_acrobatics.phpt" role="test" /> + <file name="all.phpt" role="test" /> + <file name="allU.phpt" role="test" /> <file name="badalias.phpt" role="test" /> <file name="badchecksum.phpt" role="test" /> <file name="bignames.phpt" role="test" /> @@ -239,11 +330,16 @@ <file name="links5.phpt" role="test" /> <file name="open_for_write_existing.phpt" role="test" /> <file name="open_for_write_existing_b.phpt" role="test" /> + <file name="open_for_write_existing_b_5_2.phpt" role="test" /> <file name="open_for_write_existing_c.phpt" role="test" /> + <file name="open_for_write_existing_c_5_2.phpt" role="test" /> <file name="open_for_write_newfile.phpt" role="test" /> <file name="open_for_write_newfile_b.phpt" role="test" /> + <file name="open_for_write_newfile_b_5_2.phpt" role="test" /> <file name="open_for_write_newfile_c.phpt" role="test" /> + <file name="open_for_write_newfile_c_5_2.phpt" role="test" /> <file name="phar_begin_setstub_commit.phpt" role="test" /> + <file name="phar_begin_setstub_commitU.phpt" role="test" /> <file name="phar_buildfromiterator4.phpt" role="test" /> <file name="phar_buildfromiterator5.phpt" role="test" /> <file name="phar_buildfromiterator6.phpt" role="test" /> @@ -259,17 +355,24 @@ <file name="phar_setalias.phpt" role="test" /> <file name="phar_setalias2.phpt" role="test" /> <file name="phar_setdefaultstub.phpt" role="test" /> + <file name="phar_setsignaturealgo2.phpt" role="test" /> <file name="phar_stub.phpt" role="test" /> <file name="phar_stub_error.phpt" role="test" /> <file name="refcount1.phpt" role="test" /> <file name="refcount1_5_2.phpt" role="test" /> <file name="rename.phpt" role="test" /> + <file name="rename_dir.phpt" role="test" /> + <file name="require_hash.phpt" role="test" /> + <file name="rmdir.phpt" role="test" /> <file name="tar_001.phpt" role="test" /> <file name="tar_002.phpt" role="test" /> <file name="tar_003.phpt" role="test" /> <file name="tar_004.phpt" role="test" /> + <file name="tar_004U.phpt" role="test" /> <file name="tar_bz2.phpt" role="test" /> + <file name="tar_bz2U.phpt" role="test" /> <file name="tar_gzip.phpt" role="test" /> + <file name="tar_gzipU.phpt" role="test" /> <file name="tar_makebz2.phpt" role="test" /> <file name="tar_makegz.phpt" role="test" /> <file name="tar_nostub.phpt" role="test" /> @@ -282,6 +385,7 @@ <file name="badalias3.phar.zip" role="test" /> <file name="badalias4.phar.zip" role="test" /> <file name="badalias5.phar.zip" role="test" /> + <file name="bzip2.zip" role="test" /> <file name="cdir_offset.zip" role="test" /> <file name="compress_unsup1.zip" role="test" /> <file name="compress_unsup2.zip" role="test" /> @@ -299,11 +403,14 @@ <file name="compress_unsup98.zip" role="test" /> <file name="compress_unsupunknown.zip" role="test" /> <file name="corrupt2.php.inc" role="test" /> + <file name="corrupt3.php.inc" role="test" /> <file name="corrupt_count1.php.inc" role="test" /> <file name="corrupt_zipmaker.php.inc" role="test" /> <file name="count1.zip" role="test" /> <file name="count2.zip" role="test" /> + <file name="disknumber.zip" role="test" /> <file name="encrypted.zip" role="test" /> + <file name="extralen_toolong.zip" role="test" /> <file name="filecomment.zip" role="test" /> <file name="frontcontroller.phar.inc" role="test" /> <file name="frontcontroller.phar.zip" role="test" /> @@ -343,7 +450,9 @@ <file name="033a.phpt" role="test" /> <file name="alias_acrobatics.phpt" role="test" /> <file name="all.phpt" role="test" /> + <file name="allU.phpt" role="test" /> <file name="badalias.phpt" role="test" /> + <file name="bzip2.phpt" role="test" /> <file name="corrupt_001.phpt" role="test" /> <file name="corrupt_002.phpt" role="test" /> <file name="corrupt_003.phpt" role="test" /> @@ -352,6 +461,8 @@ <file name="corrupt_006.phpt" role="test" /> <file name="corrupt_007.phpt" role="test" /> <file name="corrupt_008.phpt" role="test" /> + <file name="corrupt_009.phpt" role="test" /> + <file name="corrupt_010.phpt" role="test" /> <file name="create_new_and_modify.phpt" role="test" /> <file name="create_new_phar_b.phpt" role="test" /> <file name="delete.phpt" role="test" /> @@ -384,15 +495,21 @@ <file name="getalias.phpt" role="test" /> <file name="largezip.phpt" role="test" /> <file name="metadata_write_commit.phpt" role="test" /> + <file name="metadata_write_commitU.phpt" role="test" /> <file name="notphar.phpt" role="test" /> <file name="odt.phpt" role="test" /> <file name="open_for_write_existing.phpt" role="test" /> <file name="open_for_write_existing_b.phpt" role="test" /> + <file name="open_for_write_existing_b_5_2.phpt" role="test" /> <file name="open_for_write_existing_c.phpt" role="test" /> + <file name="open_for_write_existing_c_5_2.phpt" role="test" /> <file name="open_for_write_newfile.phpt" role="test" /> <file name="open_for_write_newfile_b.phpt" role="test" /> + <file name="open_for_write_newfile_b_5_2.phpt" role="test" /> <file name="open_for_write_newfile_c.phpt" role="test" /> + <file name="open_for_write_newfile_c_5_2.phpt" role="test" /> <file name="phar_begin_setstub_commit.phpt" role="test" /> + <file name="phar_begin_setstub_commitU.phpt" role="test" /> <file name="phar_buildfromiterator4.phpt" role="test" /> <file name="phar_buildfromiterator5.phpt" role="test" /> <file name="phar_buildfromiterator6.phpt" role="test" /> @@ -403,6 +520,7 @@ <file name="phar_convert_phar.phpt" role="test" /> <file name="phar_copy.phpt" role="test" /> <file name="phar_magic.phpt" role="test" /> + <file name="phar_magicU.phpt" role="test" /> <file name="phar_oo_compressallbz2.phpt" role="test" /> <file name="phar_oo_compressallgz.phpt" role="test" /> <file name="phar_setalias.phpt" role="test" /> @@ -413,6 +531,8 @@ <file name="refcount1.phpt" role="test" /> <file name="refcount1_5_2.phpt" role="test" /> <file name="rename.phpt" role="test" /> + <file name="rename_dir.phpt" role="test" /> + <file name="rmdir.phpt" role="test" /> <file name="unixzip.phpt" role="test" /> </dir> <!-- /tests/zip --> <file name="001.phpt" role="test" /> @@ -435,10 +555,14 @@ <file name="016.phpt" role="test" /> <file name="016b.phpt" role="test" /> <file name="017.phpt" role="test" /> + <file name="017U.phpt" role="test" /> <file name="018.phpt" role="test" /> + <file name="018U.phpt" role="test" /> <file name="019.phpt" role="test" /> <file name="019b.phpt" role="test" /> + <file name="019bU.phpt" role="test" /> <file name="019c.phpt" role="test" /> + <file name="019cU.phpt" role="test" /> <file name="020.phpt" role="test" /> <file name="021.phpt" role="test" /> <file name="022.phpt" role="test" /> @@ -447,6 +571,7 @@ <file name="025.phpt" role="test" /> <file name="026.phpt" role="test" /> <file name="027.phpt" role="test" /> + <file name="027U.phpt" role="test" /> <file name="028.phpt" role="test" /> <file name="029.phpt" role="test" /> <file name="030.phpt" role="test" /> @@ -459,6 +584,10 @@ <file name="badparameters.phpt" role="test" /> <file name="bug13727.phpt" role="test" /> <file name="bug13786.phpt" role="test" /> + <file name="bug45218_SLOWTEST.phpt" role="test" /> + <file name="bug45218_SLOWTESTU.phpt" role="test" /> + <file name="cached_manifest_1.phpt" role="test" /> + <file name="cached_manifest_1U.phpt" role="test" /> <file name="create_new_and_modify.phpt" role="test" /> <file name="create_new_phar.phpt" role="test" /> <file name="create_new_phar_b.phpt" role="test" /> @@ -475,6 +604,7 @@ <file name="fopen5.2.phpt" role="test" /> <file name="fopen_edgecases.phpt" role="test" /> <file name="fopen_edgecases2.phpt" role="test" /> + <file name="front.phar.phpt" role="test" /> <file name="frontcontroller1.phpt" role="test" /> <file name="frontcontroller2.phpt" role="test" /> <file name="frontcontroller3.phpt" role="test" /> @@ -511,24 +641,34 @@ <file name="frontcontroller34.phpt" role="test" /> <file name="include_path.phpt" role="test" /> <file name="ini_set.phpt" role="test" /> + <file name="ini_setU.phpt" role="test" /> <file name="ini_set_off.phpt" role="test" /> + <file name="ini_set_offU.phpt" role="test" /> <file name="invalid_alias.phpt" role="test" /> <file name="invalid_setstubalias.phpt" role="test" /> <file name="metadata_read.phpt" role="test" /> + <file name="metadata_readU.phpt" role="test" /> <file name="metadata_write.phpt" role="test" /> + <file name="metadata_writeU.phpt" role="test" /> <file name="metadata_write_commit.phpt" role="test" /> + <file name="metadata_write_commitU.phpt" role="test" /> <file name="mkdir.phpt" role="test" /> <file name="mounteddir.phpt" role="test" /> + <file name="mounteddirU.phpt" role="test" /> <file name="nophar.phpt" role="test" /> <file name="nophar_web.phpt" role="test" /> <file name="opendir.phpt" role="test" /> <file name="opendir_edgecases.phpt" role="test" /> <file name="open_for_write_existing.phpt" role="test" /> <file name="open_for_write_existing_b.phpt" role="test" /> + <file name="open_for_write_existing_b_5_2.phpt" role="test" /> <file name="open_for_write_existing_c.phpt" role="test" /> + <file name="open_for_write_existing_c_5_2.phpt" role="test" /> <file name="open_for_write_newfile.phpt" role="test" /> <file name="open_for_write_newfile_b.phpt" role="test" /> + <file name="open_for_write_newfile_b_5_2.phpt" role="test" /> <file name="open_for_write_newfile_c.phpt" role="test" /> + <file name="open_for_write_newfile_c_5_2.phpt" role="test" /> <file name="pharfileinfo_chmod.phpt" role="test" /> <file name="pharfileinfo_compression.phpt" role="test" /> <file name="pharfileinfo_construct.phpt" role="test" /> @@ -536,6 +676,7 @@ <file name="pharfileinfo_getcrc32.phpt" role="test" /> <file name="pharfileinfo_setmetadata.phpt" role="test" /> <file name="phar_begin_setstub_commit.phpt" role="test" /> + <file name="phar_begin_setstub_commitU.phpt" role="test" /> <file name="phar_buildfromdirectory1.phpt" role="test" /> <file name="phar_buildfromdirectory2.phpt" role="test" /> <file name="phar_buildfromdirectory3.phpt" role="test" /> @@ -552,7 +693,9 @@ <file name="phar_buildfromiterator8.phpt" role="test" /> <file name="phar_buildfromiterator9.phpt" role="test" /> <file name="phar_buildfromiterator10.phpt" role="test" /> + <file name="phar_buildfromiterator10U.phpt" role="test" /> <file name="phar_bz2.phpt" role="test" /> + <file name="phar_bz2U.phpt" role="test" /> <file name="phar_commitwrite.phpt" role="test" /> <file name="phar_convert_again.phpt" role="test" /> <file name="phar_convert_repeated.phpt" role="test" /> @@ -567,26 +710,40 @@ <file name="phar_ctx_001.phpt" role="test" /> <file name="phar_decompress.phpt" role="test" /> <file name="phar_dir_iterate.phpt" role="test" /> + <file name="phar_dotted_path.phpt" role="test" /> <file name="phar_extract.phpt" role="test" /> + <file name="phar_extract2.phpt" role="test" /> + <file name="phar_extract3.phpt" role="test" /> <file name="phar_get_supportedcomp1.phpt" role="test" /> <file name="phar_get_supportedcomp2.phpt" role="test" /> <file name="phar_get_supportedcomp3.phpt" role="test" /> <file name="phar_get_supportedcomp4.phpt" role="test" /> <file name="phar_get_supported_signatures_001.phpt" role="test" /> + <file name="phar_get_supported_signatures_001a.phpt" role="test" /> <file name="phar_get_supported_signatures_002.phpt" role="test" /> + <file name="phar_get_supported_signatures_002a.phpt" role="test" /> <file name="phar_gobyebye.phpt" role="test" /> <file name="phar_gzip.phpt" role="test" /> + <file name="phar_gzipU.phpt" role="test" /> <file name="phar_isvalidpharfilename.phpt" role="test" /> <file name="phar_magic.phpt" role="test" /> <file name="phar_metadata_read.phpt" role="test" /> + <file name="phar_metadata_readU.phpt" role="test" /> <file name="phar_metadata_write.phpt" role="test" /> + <file name="phar_metadata_writeU.phpt" role="test" /> <file name="phar_mount.phpt" role="test" /> + <file name="phar_offset_check.phpt" role="test" /> <file name="phar_offset_get_error.phpt" role="test" /> <file name="phar_oo_001.phpt" role="test" /> + <file name="phar_oo_001U.phpt" role="test" /> <file name="phar_oo_002.phpt" role="test" /> + <file name="phar_oo_002U.phpt" role="test" /> <file name="phar_oo_003.phpt" role="test" /> <file name="phar_oo_004.phpt" role="test" /> + <file name="phar_oo_004U.phpt" role="test" /> <file name="phar_oo_005.phpt" role="test" /> + <file name="phar_oo_005U.phpt" role="test" /> + <file name="phar_oo_005_5.2.phpt" role="test" /> <file name="phar_oo_006.phpt" role="test" /> <file name="phar_oo_007.phpt" role="test" /> <file name="phar_oo_008.phpt" role="test" /> @@ -629,6 +786,9 @@ <file name="refcount1.phpt" role="test" /> <file name="refcount1_5_2.phpt" role="test" /> <file name="rename.phpt" role="test" /> + <file name="rename_dir.phpt" role="test" /> + <file name="rename_dir_and_mount.phpt" role="test" /> + <file name="rmdir.phpt" role="test" /> <file name="security.phpt" role="test" /> <file name="stat.phpt" role="test" /> <file name="stat2.phpt" role="test" /> @@ -676,7 +836,7 @@ <dependencies> <required> <php> - <min>5.2.0</min> + <min>5.2.1</min> </php> <pearinstaller> <min>1.4.3</min> @@ -706,14 +866,14 @@ <changelog> <release> <version> - <release>2.0.0b1</release> + <release>2.0.0RC1</release> <api>1.1.1</api> </version> <stability> <release>beta</release> <api>beta</api> </stability> - <date>2008-05-12</date> + <date>2008-08-31</date> <license uri="http://www.php.net/license">PHP License</license> <notes> @@ -724,8 +884,12 @@ * phar.extract_list and Phar::getExtractList() are removed Major feature functionality release + * phar.cache_list allows web-based phar applications to run at equal or faster than + their on-disk equivalent [Greg] * new default stub allows running of phar-based phars without phar extension [Greg/Steph] * add support for tar-based and zip-based phar archives [Greg] + * add support for OpenSSL-based true signatures [Greg] + * add support for signatures to tar-based phar archives [Greg] * add Phar::isFileFormat() [Greg] * add Phar::convertToExecutable(), Phar::convertToData() [Greg] * add Phar::compress() [Greg] @@ -757,11 +921,67 @@ Changes since 2.0.0a2: many bugfixes, removal of phar.extract_list, compression API refactored, conversion API refactored +Changes since 2.0.0b1: addition of phar.cache_list, many performance improvements and bugfixes + implement OpenSSL asynchronous true package signing + add support for package signing to tar-based archives + require PHP 5.2.1+ </notes> </release> <release> <version> + <release>2.0.0b1</release> + <api>1.1.1</api> + </version> + <stability> + <release>beta</release> + <api>beta</api> + </stability> + <date>2008-05-12</date> + <license uri="http://www.php.net/license">PHP License</license> + <notes>BC BREAKING RELEASE + BC breaks: + * Phar object Compression API is rewritten. Use Phar::compress() and decompress(), + Phar::compressFiles()/decompressFiles() and PharFileInfo-&gt;compress()/decompress(). + * phar.extract_list and Phar::getExtractList() are removed + +Major feature functionality release + * new default stub allows running of phar-based phars without phar extension [Greg/Steph] + * add support for tar-based and zip-based phar archives [Greg] + * add Phar::isFileFormat() [Greg] + * add Phar::convertToExecutable(), Phar::convertToData() [Greg] + * add Phar::compress() [Greg] + * rename Phar::compressAllFiles() to compressFiles(), uncompressAllFiles() to + decompressFiles() [Greg] + * conversion to compressed or to other file formats automatically copies the archive + to a new extension (i.e. &quot;.phar&quot; to &quot;.phar.tar&quot; or &quot;.tar&quot; to &quot;.tar.gz&quot;) [Steph] + * add Phar::webPhar() for running a web-based application unmodified + directly from a phar archive [Greg] + * file functions (fopen-based and stat-based) can be instructed to only look for + relative paths within a phar via Phar::interceptFileFuncs() + * add PharData class to allow manipulation/creation of non-executable tar and zip archives. [Steph] + non-executable tar/zip manipulation is allowed even when phar.readonly=1 [Greg] + * paths with . and .. work (phar://blah.phar/a/../b.php =&gt; phar://blah.phar/b.php) [Greg] + * add support for mkdir()/rmdir() and support for empty directories to phar file format [Greg] + * add option to compress the entire phar file for phar/tar file format [Greg] + * implement Phar::isCompressed() returning 0, Phar::GZ or Phar::BZ2 [Greg] + * implement Phar::copy(string $from, string $to) [Greg] + * implement Phar::running(), returns path or URL to currently executed phar + * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg] + * implement Phar::buildFromDirectory(string $base_directory[, string $regex]) [Steph] + * implement Phar::mount() for mounting external paths or files to locations inside a phar [Greg] + * add Phar::delete() [Greg] + * implement Phar::unlinkArchive() [Greg] + +Security addition + * aliases are validated so that they contain no directory separators as intended + * on conversion to other formats, user-supplied aliases are validated + +Changes since 2.0.0a2: many bugfixes, removal of phar.extract_list, compression API refactored, + conversion API refactored</notes> + </release> + <release> + <version> <release>2.0.0a2</release> <api>1.1.1</api> </version> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.c?r1=1.382&r2=1.383&diff_format=u Index: php-src/ext/phar/phar.c diff -u php-src/ext/phar/phar.c:1.382 php-src/ext/phar/phar.c:1.383 --- php-src/ext/phar/phar.c:1.382 Thu Aug 14 13:02:13 2008 +++ php-src/ext/phar/phar.c Sun Aug 31 20:54:27 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: phar.c,v 1.382 2008/08/14 13:02:13 dmitry Exp $ */ +/* $Id: phar.c,v 1.383 2008/08/31 20:54:27 sfox Exp $ */ #define PHAR_MAIN 1 #include "phar_internal.h" @@ -2305,7 +2305,6 @@ int phar_open_executed_filename(char *alias, int alias_len, char **error TSRMLS_DC) /* {{{ */ { char *fname; - long halt_offset; zval *halt_constant; php_stream *fp; int fname_len; @@ -2340,7 +2339,6 @@ return FAILURE; } - halt_offset = Z_LVAL(*halt_constant); FREE_ZVAL(halt_constant); #if PHP_MAJOR_VERSION < 6 @@ -2383,7 +2381,7 @@ /** * Validate the CRC32 of a file opened from within the phar */ -int phar_postprocess_file(php_stream_wrapper *wrapper, int options, phar_entry_data *idata, php_uint32 crc32, char **error TSRMLS_DC) /* {{{ */ +int phar_postprocess_file(phar_entry_data *idata, php_uint32 crc32, char **error, int process_zip TSRMLS_DC) /* {{{ */ { php_uint32 crc = ~0; int len = idata->internal_file->uncompressed_filesize; @@ -2394,7 +2392,7 @@ *error = NULL; } - if (entry->is_zip) { + if (entry->is_zip && process_zip > 0) { /* verify local file header */ phar_zip_file_header local; @@ -2425,6 +2423,10 @@ } } + if (process_zip == 1) { + return SUCCESS; + } + php_stream_seek(fp, idata->zero, SEEK_SET); while (len--) { @@ -2437,7 +2439,7 @@ entry->is_crc_checked = 1; return SUCCESS; } else { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: internal corruption of phar \"%s\" (crc32 mismatch on file \"%s\")", idata->phar->fname, entry->filename); + spprintf(error, 0, "phar error: internal corruption of phar \"%s\" (crc32 mismatch on file \"%s\")", idata->phar->fname, entry->filename); return FAILURE; } } @@ -2515,125 +2517,6 @@ } /* }}} */ -#ifndef PHAR_HAVE_OPENSSL -static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC) /* {{{ */ -{ - zend_fcall_info fci; - zend_fcall_info_cache fcc; - zval *zdata, *zsig, *zkey, *retval_ptr, **zp[3], *openssl; - - MAKE_STD_ZVAL(zdata); - MAKE_STD_ZVAL(openssl); - ZVAL_STRINGL(openssl, is_sign ? "openssl_sign" : "openssl_verify", is_sign ? sizeof("openssl_sign")-1 : sizeof("openssl_verify")-1, 1); - MAKE_STD_ZVAL(zsig); - ZVAL_STRINGL(zsig, *signature, *signature_len, 1); - MAKE_STD_ZVAL(zkey); - ZVAL_STRINGL(zkey, key, key_len, 1); - zp[0] = &zdata; - zp[1] = &zsig; - zp[2] = &zkey; - - php_stream_rewind(fp); - Z_TYPE_P(zdata) = IS_STRING; - Z_STRLEN_P(zdata) = end; - if (end != (off_t) php_stream_copy_to_mem(fp, &(Z_STRVAL_P(zdata)), (size_t) end, 0)) { - zval_dtor(zdata); - zval_dtor(zsig); - zval_dtor(zkey); - return FAILURE; - } - -#if PHP_VERSION_ID < 50300 - if (FAILURE == zend_fcall_info_init(openssl, &fci, &fcc TSRMLS_CC)) { -#else - if (FAILURE == zend_fcall_info_init(openssl, 0, &fci, &fcc, NULL, NULL TSRMLS_CC)) { -#endif - zval_dtor(zdata); - zval_dtor(zsig); - zval_dtor(zkey); - zval_dtor(openssl); - return FAILURE; - } - - zval_dtor(openssl); - efree(openssl); - - fci.param_count = 3; - fci.params = zp; -#if PHP_VERSION_ID < 50300 - ++(zdata->refcount); - ++(zsig->refcount); - ++(zkey->refcount); -#else - Z_ADDREF_P(zdata); - - if (is_sign) { - Z_SET_ISREF_P(zsig); - } else { - Z_ADDREF_P(zsig); - } - - Z_ADDREF_P(zkey); -#endif - fci.retval_ptr_ptr = &retval_ptr; - - if (FAILURE == zend_call_function(&fci, &fcc TSRMLS_CC)) { - zval_dtor(zdata); - zval_dtor(zsig); - zval_dtor(zkey); - efree(zdata); - efree(zkey); - efree(zsig); - return FAILURE; - } -#if PHP_VERSION_ID < 50300 - --(zdata->refcount); - --(zsig->refcount); - --(zkey->refcount); -#else - Z_DELREF_P(zdata); - - if (is_sign) { - Z_UNSET_ISREF_P(zsig); - } else { - Z_DELREF_P(zsig); - } - - Z_DELREF_P(zkey); -#endif - zval_dtor(zdata); - efree(zdata); - zval_dtor(zkey); - efree(zkey); - - switch (Z_TYPE_P(retval_ptr)) { - default: - case IS_LONG: - zval_dtor(zsig); - efree(zsig); - if (1 == Z_LVAL_P(retval_ptr)) { - efree(retval_ptr); - return SUCCESS; - } - efree(retval_ptr); - return FAILURE; - case IS_BOOL: - efree(retval_ptr); - if (Z_BVAL_P(retval_ptr)) { - *signature = estrndup(Z_STRVAL_P(zsig), Z_STRLEN_P(zsig)); - *signature_len = Z_STRLEN_P(zsig); - zval_dtor(zsig); - efree(zsig); - return SUCCESS; - } - zval_dtor(zsig); - efree(zsig); - return FAILURE; - } -} -/* }}} */ -#endif /* #ifndef PHAR_HAVE_OPENSSL */ - /** * Save phar contents to disk * @@ -3302,7 +3185,6 @@ } if (phar->flags & PHAR_FILE_COMPRESSED_GZ) { - php_stream_filter *filter; /* to properly compress, we have to tell zlib to add a zlib header */ zval filterparams; @@ -3326,8 +3208,6 @@ /* use the temp stream as our base */ phar->fp = newfile; } else if (phar->flags & PHAR_FILE_COMPRESSED_BZ2) { - php_stream_filter *filter; - filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp) TSRMLS_CC); php_stream_filter_append(&phar->fp->writefilters, filter); php_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL); @@ -3733,7 +3613,7 @@ php_info_print_table_header(2, "Phar: PHP Archive support", "enabled"); php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION); php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION); - php_info_print_table_row(2, "CVS revision", "$Revision: 1.382 $"); + php_info_print_table_row(2, "CVS revision", "$Revision: 1.383 $"); php_info_print_table_row(2, "Phar-based phar archives", "enabled"); php_info_print_table_row(2, "Tar-based phar archives", "enabled"); php_info_print_table_row(2, "ZIP-based phar archives", "enabled"); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_internal.h?r1=1.115&r2=1.116&diff_format=u Index: php-src/ext/phar/phar_internal.h diff -u php-src/ext/phar/phar_internal.h:1.115 php-src/ext/phar/phar_internal.h:1.116 --- php-src/ext/phar/phar_internal.h:1.115 Fri Aug 1 13:45:05 2008 +++ php-src/ext/phar/phar_internal.h Sun Aug 31 20:54:27 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: phar_internal.h,v 1.115 2008/08/01 13:45:05 sfox Exp $ */ +/* $Id: phar_internal.h,v 1.116 2008/08/31 20:54:27 sfox Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -576,6 +576,7 @@ void phar_destroy_phar_data(phar_archive_data *phar TSRMLS_DC); int phar_open_entry_file(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC); +int phar_postprocess_file(phar_entry_data *idata, php_uint32 crc32, char **error, int process_zip TSRMLS_DC); int phar_open_from_filename(char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error TSRMLS_DC); int phar_open_or_create_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC); int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_object.c?r1=1.281&r2=1.282&diff_format=u Index: php-src/ext/phar/phar_object.c diff -u php-src/ext/phar/phar_object.c:1.281 php-src/ext/phar/phar_object.c:1.282 --- php-src/ext/phar/phar_object.c:1.281 Fri Aug 1 13:45:05 2008 +++ php-src/ext/phar/phar_object.c Sun Aug 31 20:54:27 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: phar_object.c,v 1.281 2008/08/01 13:45:05 sfox Exp $ */ +/* $Id: phar_object.c,v 1.282 2008/08/31 20:54:27 sfox Exp $ */ #include "phar_internal.h" #include "func_interceptors.h" @@ -203,7 +203,7 @@ ctr.line_len = spprintf(&(ctr.line), 0, "Content-type: %s", mime_type); sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC); efree(ctr.line); - ctr.line_len = spprintf(&(ctr.line), 0, "Content-length: %d", info->uncompressed_filesize); + ctr.line_len = spprintf(&(ctr.line), 0, "Content-length: %u", info->uncompressed_filesize); sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC); efree(ctr.line); @@ -1393,7 +1393,7 @@ { zval **value; zend_uchar key_type; - zend_bool is_splfileinfo = 0, close_fp = 1; + zend_bool close_fp = 1; ulong int_key; struct _phar_t *p_obj = (struct _phar_t*) puser; uint str_key_len, base_len = p_obj->l, fname_len; @@ -1448,7 +1448,12 @@ } if (key_type > 9) { /* IS_UNICODE == 10 */ +#if PHP_VERSION_ID < 60000 +/* this can never happen, but fixes a compile warning */ + spprintf(&str_key, 0, "%s", key); +#else spprintf(&str_key, 0, "%v", key); +#endif } else { PHAR_STR(key, str_key); } @@ -1505,7 +1510,6 @@ } save = fname; - is_splfileinfo = 1; goto phar_spl_fileinfo; case SPL_FS_INFO: case SPL_FS_FILE: @@ -1516,7 +1520,6 @@ #endif fname_len = strlen(fname); save = fname; - is_splfileinfo = 1; goto phar_spl_fileinfo; } } @@ -1577,7 +1580,12 @@ } if (key_type > 9) { /* IS_UNICODE == 10 */ +#if PHP_VERSION_ID < 60000 +/* this can never happen, but fixes a compile warning */ + spprintf(&str_key, 0, "%s", key); +#else spprintf(&str_key, 0, "%v", key); +#endif } else { PHAR_STR(key, str_key); } @@ -1986,6 +1994,7 @@ char *error; const char *pcr_error; int ext_len = ext ? strlen(ext) : 0; + int oldname_len; phar_archive_data **pphar = NULL; if (!ext) { @@ -2051,12 +2060,13 @@ oldpath = estrndup(phar->fname, phar->fname_len); oldname = zend_memrchr(phar->fname, '/', phar->fname_len); ++oldname; + oldname_len = strlen(oldname); - basename = estrndup(oldname, strlen(oldname)); + basename = estrndup(oldname, oldname_len); spprintf(&newname, 0, "%s.%s", strtok(basename, "."), ext); efree(basename); - basepath = estrndup(oldpath, strlen(oldpath) - strlen(oldname)); + basepath = estrndup(oldpath, (strlen(oldpath) - oldname_len)); phar->fname_len = spprintf(&newpath, 0, "%s%s", basepath, newname); phar->fname = newpath; phar->ext = newpath + phar->fname_len - strlen(ext) - 1; @@ -2986,7 +2996,7 @@ add_assoc_stringl(return_value, "hash_type", "OpenSSL", 7, 1); break; default: - unknown_len = spprintf(&unknown, 0, "Unknown (%d)", phar_obj->arc.archive->sig_flags); + unknown_len = spprintf(&unknown, 0, "Unknown (%u)", phar_obj->arc.archive->sig_flags); add_assoc_stringl(return_value, "hash_type", unknown, unknown_len, 0); break; } @@ -4638,7 +4648,6 @@ case PHAR_ENT_COMPRESSED_GZ: if (entry_obj->ent.entry->flags & PHAR_ENT_COMPRESSED_GZ) { RETURN_TRUE; - return; } if ((entry_obj->ent.entry->flags & PHAR_ENT_COMPRESSED_BZ2) != 0) { @@ -4670,7 +4679,6 @@ case PHAR_ENT_COMPRESSED_BZ2: if (entry_obj->ent.entry->flags & PHAR_ENT_COMPRESSED_BZ2) { RETURN_TRUE; - return; } if ((entry_obj->ent.entry->flags & PHAR_ENT_COMPRESSED_GZ) != 0) { @@ -4732,7 +4740,6 @@ if ((entry_obj->ent.entry->flags & PHAR_ENT_COMPRESSION_MASK) == 0) { RETURN_TRUE; - return; } if (PHAR_G(readonly) && !entry_obj->ent.entry->phar->is_data) { @@ -4791,36 +4798,36 @@ ZEND_ARG_INFO(0, flags) ZEND_ARG_INFO(0, alias) ZEND_ARG_INFO(0, fileformat) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_createDS, 0, 0, 0) ZEND_ARG_INFO(0, index) ZEND_ARG_INFO(0, webindex) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_loadPhar, 0, 0, 1) ZEND_ARG_INFO(0, filename) ZEND_ARG_INFO(0, alias) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_mapPhar, 0, 0, 0) ZEND_ARG_INFO(0, alias) ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_mount, 0, 0, 2) ZEND_ARG_INFO(0, inphar) ZEND_ARG_INFO(0, externalfile) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_mungServer, 0, 0, 1) ZEND_ARG_INFO(0, munglist) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_webPhar, 0, 0, 0) @@ -4829,17 +4836,17 @@ ZEND_ARG_INFO(0, f404) ZEND_ARG_INFO(0, mimetypes) ZEND_ARG_INFO(0, rewrites) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_running, 0, 0, 1) ZEND_ARG_INFO(0, retphar) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_ua, 0, 0, 1) ZEND_ARG_INFO(0, archive) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() #if HAVE_SPL @@ -4847,114 +4854,114 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_build, 0, 0, 1) ZEND_ARG_INFO(0, iterator) ZEND_ARG_INFO(0, base_directory) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_conv, 0, 0, 0) ZEND_ARG_INFO(0, format) ZEND_ARG_INFO(0, compression_type) ZEND_ARG_INFO(0, file_ext) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_comps, 0, 0, 1) ZEND_ARG_INFO(0, compression_type) ZEND_ARG_INFO(0, file_ext) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_decomp, 0, 0, 0) ZEND_ARG_INFO(0, file_ext) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_comp, 0, 0, 1) ZEND_ARG_INFO(0, compression_type) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_compo, 0, 0, 0) ZEND_ARG_INFO(0, compression_type) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_copy, 0, 0, 2) ZEND_ARG_INFO(0, newfile) ZEND_ARG_INFO(0, oldfile) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_delete, 0, 0, 1) ZEND_ARG_INFO(0, entry) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_fromdir, 0, 0, 1) ZEND_ARG_INFO(0, base_dir) ZEND_ARG_INFO(0, regex) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_offsetExists, 0, 0, 1) ZEND_ARG_INFO(0, entry) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_offsetSet, 0, 0, 2) ZEND_ARG_INFO(0, entry) ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setAlias, 0, 0, 1) ZEND_ARG_INFO(0, alias) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setMetadata, 0, 0, 1) ZEND_ARG_INFO(0, metadata) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setSigAlgo, 0, 0, 1) ZEND_ARG_INFO(0, algorithm) ZEND_ARG_INFO(0, privatekey) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setStub, 0, 0, 1) ZEND_ARG_INFO(0, newstub) ZEND_ARG_INFO(0, maxlen) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_emptydir, 0, 0, 0) ZEND_ARG_INFO(0, dirname) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_extract, 0, 0, 1) ZEND_ARG_INFO(0, pathto) ZEND_ARG_INFO(0, files) ZEND_ARG_INFO(0, overwrite) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_addfile, 0, 0, 1) ZEND_ARG_INFO(0, filename) ZEND_ARG_INFO(0, localname) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_fromstring, 0, 0, 1) ZEND_ARG_INFO(0, localname) ZEND_ARG_INFO(0, contents) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_isff, 0, 0, 1) ZEND_ARG_INFO(0, fileformat) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() #endif /* HAVE_SPL */ @@ -5026,12 +5033,12 @@ static ZEND_BEGIN_ARG_INFO_EX(arginfo_entry___construct, 0, 0, 1) ZEND_ARG_INFO(0, filename) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO_EX(arginfo_entry_chmod, 0, 0, 1) ZEND_ARG_INFO(0, perms) -ZEND_END_ARG_INFO(); +ZEND_END_ARG_INFO() zend_function_entry php_entry_methods[] = { PHP_ME(PharFileInfo, __construct, arginfo_entry___construct, ZEND_ACC_PUBLIC) http://cvs.php.net/viewvc.cgi/php-src/ext/phar/php_phar.h?r1=1.17&r2=1.18&diff_format=u Index: php-src/ext/phar/php_phar.h diff -u php-src/ext/phar/php_phar.h:1.17 php-src/ext/phar/php_phar.h:1.18 --- php-src/ext/phar/php_phar.h:1.17 Fri Aug 1 13:45:06 2008 +++ php-src/ext/phar/php_phar.h Sun Aug 31 20:54:27 2008 @@ -17,12 +17,12 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_phar.h,v 1.17 2008/08/01 13:45:06 sfox Exp $ */ +/* $Id: php_phar.h,v 1.18 2008/08/31 20:54:27 sfox Exp $ */ #ifndef PHP_PHAR_H #define PHP_PHAR_H -#define PHP_PHAR_VERSION "2.0.0b2-dev" +#define PHP_PHAR_VERSION "2.0.0RC2-dev" #include "ext/standard/basic_functions.h" extern zend_module_entry phar_module_entry; http://cvs.php.net/viewvc.cgi/php-src/ext/phar/stream.c?r1=1.33&r2=1.34&diff_format=u Index: php-src/ext/phar/stream.c diff -u php-src/ext/phar/stream.c:1.33 php-src/ext/phar/stream.c:1.34 --- php-src/ext/phar/stream.c:1.33 Fri Aug 1 16:28:19 2008 +++ php-src/ext/phar/stream.c Sun Aug 31 20:54:27 2008 @@ -307,8 +307,9 @@ #endif /* check length, crc32 */ - if (!idata->internal_file->is_crc_checked && phar_postprocess_file(wrapper, options, idata, idata->internal_file->crc32, &error TSRMLS_CC) != SUCCESS) { - /* already issued the error */ + if (!idata->internal_file->is_crc_checked && phar_postprocess_file(idata, idata->internal_file->crc32, &error, 2 TSRMLS_CC) != SUCCESS) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, error); + efree(error); phar_entry_delref(idata TSRMLS_CC); efree(internal_file); return NULL; @@ -675,6 +676,7 @@ { php_url *resource; char *internal_file, *error; + int internal_file_len; phar_entry_data *idata; phar_archive_data **pphar; uint host_len; @@ -700,7 +702,7 @@ host_len = strlen(resource->host); phar_request_initialize(TSRMLS_C); - if (FAILURE == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), resource->host, strlen(resource->host), (void **) &pphar)) { + if (FAILURE == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), resource->host, host_len, (void **) &pphar)) { pphar = NULL; } if (PHAR_G(readonly) && (!pphar || !(*pphar)->is_data)) { @@ -711,7 +713,8 @@ /* need to copy to strip leading "/", will get touched again */ internal_file = estrdup(resource->path + 1); - if (FAILURE == phar_get_entry_data(&idata, resource->host, strlen(resource->host), internal_file, strlen(internal_file), "r", 0, &error, 1 TSRMLS_CC)) { + internal_file_len = strlen(internal_file); + if (FAILURE == phar_get_entry_data(&idata, resource->host, host_len, internal_file, internal_file_len, "r", 0, &error, 1 TSRMLS_CC)) { /* constraints of fp refcount were not met */ if (error) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "unlink of \"%s\" failed: %s", url, error); @@ -828,7 +831,7 @@ host_len = strlen(resource_from->host); - if (SUCCESS != phar_get_archive(&phar, resource_from->host, strlen(resource_from->host), NULL, 0, &error TSRMLS_CC)) { + if (SUCCESS != phar_get_archive(&phar, resource_from->host, host_len, NULL, 0, &error TSRMLS_CC)) { php_url_free(resource_from); php_url_free(resource_to); php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": %s", url_from, url_to, error); @@ -909,6 +912,7 @@ memcpy(new_str_key, resource_to->path + 1, to_len); memcpy(new_str_key + to_len, str_key + from_len, key_len - from_len); new_str_key[new_key_len] = 0; + is_modified = 1; entry->is_modified = 1; efree(entry->filename); @@ -921,7 +925,6 @@ #else zend_hash_update_current_key_ex(&phar->manifest, key_type, new_key, new_key_len, 0, HASH_UPDATE_KEY_ANYWAY, NULL); #endif - efree(new_str_key); } } http://cvs.php.net/viewvc.cgi/php-src/ext/phar/stream.h?r1=1.5&r2=1.6&diff_format=u Index: php-src/ext/phar/stream.h diff -u php-src/ext/phar/stream.h:1.5 php-src/ext/phar/stream.h:1.6 --- php-src/ext/phar/stream.h:1.5 Fri Aug 1 13:45:06 2008 +++ php-src/ext/phar/stream.h Sun Aug 31 20:54:27 2008 @@ -17,10 +17,9 @@ +----------------------------------------------------------------------+ */ -/* $Id: stream.h,v 1.5 2008/08/01 13:45:06 sfox Exp $ */ +/* $Id: stream.h,v 1.6 2008/08/31 20:54:27 sfox Exp $ */ BEGIN_EXTERN_C() -int phar_postprocess_file(php_stream_wrapper *wrapper, int options, phar_entry_data *idata, php_uint32 crc32, char **error TSRMLS_DC); php_url* phar_parse_url(php_stream_wrapper *wrapper, char *filename, char *mode, int options TSRMLS_DC); void phar_entry_remove(phar_entry_data *idata, char **error TSRMLS_DC); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tar.c?r1=1.60&r2=1.61&diff_format=u Index: php-src/ext/phar/tar.c diff -u php-src/ext/phar/tar.c:1.60 php-src/ext/phar/tar.c:1.61 --- php-src/ext/phar/tar.c:1.60 Fri Aug 1 13:45:06 2008 +++ php-src/ext/phar/tar.c Sun Aug 31 20:54:27 2008 @@ -255,7 +255,6 @@ phar_tar_number(hdr->size, sizeof(hdr->size)); if (((!old && hdr->prefix[0] == 0) || old) && strlen(hdr->name) == sizeof(".phar/signature.bin")-1 && !strncmp(hdr->name, ".phar/signature.bin", sizeof(".phar/signature.bin")-1)) { - size_t read; if (size > 511) { if (error) { spprintf(error, 4096, "phar error: tar-based phar \"%s\" has signature that is larger than 511 bytes, cannot process", fname); @@ -291,7 +290,7 @@ } /* signature checked out, let's ensure this is the last file in the phar */ size = ((size+511)&~511) + 512; - if (((hdr->typeflag == 0) || (hdr->typeflag == TAR_FILE)) && size > 0) { + if (((hdr->typeflag == '\0') || (hdr->typeflag == TAR_FILE)) && size > 0) { /* this is not good enough - seek succeeds even on truncated tars */ php_stream_seek(fp, size, SEEK_CUR); if ((uint)php_stream_tell(fp) > totalsize) { @@ -370,7 +369,7 @@ return FAILURE; } - entry.tar_type = ((old & (hdr->typeflag == 0))?'0':hdr->typeflag); + entry.tar_type = ((old & (hdr->typeflag == '\0')) ? TAR_FILE : hdr->typeflag); entry.offset = entry.offset_abs = pos; /* header_offset unused in tar */ entry.fp_type = PHAR_FP; entry.flags = phar_tar_number(hdr->mode, sizeof(hdr->mode)) & PHAR_ENT_PERM_MASK; @@ -424,7 +423,6 @@ } if (!actual_alias && entry.filename_len == sizeof(".phar/alias.txt")-1 && !strncmp(entry.filename, ".phar/alias.txt", sizeof(".phar/alias.txt")-1)) { - size_t read; /* found explicit alias */ if (size > 511) { if (error) { @@ -473,7 +471,7 @@ size = (size+511)&~511; - if (((hdr->typeflag == 0) || (hdr->typeflag == TAR_FILE)) && size > 0) { + if (((hdr->typeflag == '\0') || (hdr->typeflag == TAR_FILE)) && size > 0) { /* this is not good enough - seek succeeds even on truncated tars */ php_stream_seek(fp, size, SEEK_CUR); if ((uint)php_stream_tell(fp) > totalsize) { http://cvs.php.net/viewvc.cgi/php-src/ext/phar/util.c?r1=1.60&r2=1.61&diff_format=u Index: php-src/ext/phar/util.c diff -u php-src/ext/phar/util.c:1.60 php-src/ext/phar/util.c:1.61 --- php-src/ext/phar/util.c:1.60 Fri Aug 1 13:45:06 2008 +++ php-src/ext/phar/util.c Sun Aug 31 20:54:27 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: util.c,v 1.60 2008/08/01 13:45:06 sfox Exp $ */ +/* $Id: util.c,v 1.61 2008/08/31 20:54:27 sfox Exp $ */ #include "phar_internal.h" @@ -254,7 +254,7 @@ { #if PHP_VERSION_ID >= 50300 char *path, *fname, *arch, *entry, *ret, *test; - int arch_len, entry_len, fname_len; + int arch_len, entry_len, fname_len, ret_len; phar_archive_data *phar; if (pphar) { @@ -322,9 +322,6 @@ efree(path); if (ret && strlen(ret) > 8 && !strncmp(ret, "phar://", 7)) { - char *arch; - int arch_len, ret_len; - ret_len = strlen(ret); /* found phar:// */ @@ -475,7 +472,7 @@ wrapper = php_stream_locate_url_wrapper(trypath, &actual, STREAM_OPEN_FOR_INCLUDE TSRMLS_CC); if (wrapper == &php_plain_files_wrapper) { - strncpy(trypath, actual, MAXPATHLEN); + strlcpy(trypath, actual, sizeof(trypath)); } else if (!wrapper) { /* if wrapper is NULL, there was a mal-formed include_path stream wrapper, so skip this ptr */ continue; @@ -542,7 +539,7 @@ if (wrapper == &php_plain_files_wrapper) { /* this should never technically happen, but we'll leave it here for completeness */ - strncpy(trypath, actual, MAXPATHLEN); + strlcpy(trypath, actual, sizeof(trypath)); } else if (!wrapper) { /* if wrapper is NULL, there was a malformed include_path stream wrapper this also should be impossible */ @@ -686,7 +683,7 @@ if (entry->link) { efree(entry->link); entry->link = NULL; - entry->tar_type = (entry->tar_type ? TAR_FILE : 0); + entry->tar_type = (entry->is_tar ? TAR_FILE : '\0'); } if (for_write) { @@ -740,7 +737,7 @@ phar_unixify_path_separators(path, path_len); #endif - is_dir = (path_len > 0 && path != NULL) ? path[path_len - 1] == '/' : 0; + is_dir = (path_len && path[path_len - 1] == '/') ? 1 : 0; if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, error TSRMLS_CC)) { return NULL; @@ -877,7 +874,7 @@ if (dest->link) { efree(dest->link); dest->link = NULL; - dest->tar_type = (dest->tar_type ? TAR_FILE : 0); + dest->tar_type = (dest->is_tar ? TAR_FILE : '\0'); } dest->fp_type = PHAR_MOD; @@ -913,6 +910,7 @@ char *filtername; off_t loc; php_stream *ufp; + phar_entry_data dummy; if (follow_links && entry->link) { phar_entry_info *link_entry = phar_get_link_source(entry TSRMLS_CC); @@ -921,6 +919,10 @@ } } + if (entry->is_modified) { + return SUCCESS; + } + if (entry->fp_type == PHAR_TMP) { if (!entry->fp) { entry->fp = php_stream_open_wrapper(entry->tmp, "rb", STREAM_MUST_SEEK|0, NULL); @@ -941,6 +943,13 @@ } if ((entry->old_flags && !(entry->old_flags & PHAR_ENT_COMPRESSION_MASK)) || !(entry->flags & PHAR_ENT_COMPRESSION_MASK)) { + dummy.internal_file = entry; + dummy.phar = phar; + dummy.zero = entry->offset; + dummy.fp = phar_get_pharfp(phar TSRMLS_CC); + if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 1 TSRMLS_CC)) { + return FAILURE; + } return SUCCESS; } @@ -952,6 +961,14 @@ } } + dummy.internal_file = entry; + dummy.phar = phar; + dummy.zero = entry->offset; + dummy.fp = phar_get_pharfp(phar TSRMLS_CC); + if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 1 TSRMLS_CC)) { + return FAILURE; + } + ufp = phar_get_entrypufp(entry TSRMLS_CC); if ((filtername = phar_decompress_filter(entry, 0)) != NULL) { @@ -991,6 +1008,11 @@ /* this is now the new location of the file contents within this fp */ phar_set_fp_type(entry, PHAR_UFP, loc TSRMLS_CC); + dummy.zero = entry->offset; + dummy.fp = ufp; + if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 0 TSRMLS_CC)) { + return FAILURE; + } return SUCCESS; } /* }}} */ @@ -1057,7 +1079,7 @@ if (entry->link) { efree(entry->link); entry->link = NULL; - entry->tar_type = (entry->tar_type ? TAR_FILE : 0); + entry->tar_type = (entry->is_tar ? TAR_FILE : '\0'); } entry->fp = php_stream_fopen_tmpfile(); @@ -1114,7 +1136,7 @@ if (entry->link) { efree(entry->link); entry->link = NULL; - entry->tar_type = (entry->tar_type ? TAR_FILE : 0); + entry->tar_type = (entry->is_tar ? TAR_FILE : '\0'); } entry->offset = 0; @@ -1434,7 +1456,7 @@ phar_unixify_path_separators(path, path_len); #endif - is_dir = path_len && (path[path_len - 1] == '/'); + is_dir = (path_len && (path[path_len - 1] == '/')) ? 1 : 0; if (error) { *error = NULL; @@ -1525,7 +1547,6 @@ } else { char *test; int test_len; - phar_entry_info *entry; php_stream_statbuf ssb; if (SUCCESS != zend_hash_find(&phar->manifest, str_key, keylen, (void **) &entry)) { @@ -1638,6 +1659,7 @@ zval_dtor(zkey); return FAILURE; } + #if PHP_VERSION_ID < 50300 if (FAILURE == zend_fcall_info_init(openssl, &fci, &fcc TSRMLS_CC)) { #else @@ -1655,7 +1677,9 @@ fci.params = zp; #if PHP_VERSION_ID < 50300 ++(zdata->refcount); - ++(zsig->refcount); + if (!is_sign) { + ++(zsig->refcount); + } ++(zkey->refcount); #else Z_ADDREF_P(zdata); @@ -1684,7 +1708,9 @@ efree(openssl); #if PHP_VERSION_ID < 50300 --(zdata->refcount); - --(zsig->refcount); + if (!is_sign) { + --(zsig->refcount); + } --(zkey->refcount); #else Z_DELREF_P(zdata); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/zip.c?r1=1.52&r2=1.53&diff_format=u Index: php-src/ext/phar/zip.c diff -u php-src/ext/phar/zip.c:1.52 php-src/ext/phar/zip.c:1.53 --- php-src/ext/phar/zip.c:1.52 Fri Aug 1 13:45:06 2008 +++ php-src/ext/phar/zip.c Sun Aug 31 20:54:27 2008 @@ -159,7 +159,6 @@ phar_zip_dir_end locator; char buf[sizeof(locator) + 65536]; long size; - size_t read; php_uint16 i; phar_archive_data *mydata = NULL; phar_entry_info entry = {0}; @@ -181,7 +180,7 @@ php_stream_seek(fp, 0, SEEK_SET); } - if (!(read = php_stream_read(fp, buf, size))) { + if (!php_stream_read(fp, buf, size)) { php_stream_close(fp); if (error) { spprintf(error, 4096, "phar error: unable to read in data to search for end of central directory in zip-based phar \"%s\"", fname); @@ -491,7 +490,6 @@ php_stream_filter_remove(filter, 1 TSRMLS_CC); } else if (entry.flags & PHAR_ENT_COMPRESSED_BZ2) { - php_stream_filter *filter; filter = php_stream_filter_create("bzip2.decompress", NULL, php_stream_is_persistent(fp) TSRMLS_CC); if (!filter) { @@ -655,6 +653,7 @@ struct _phar_zip_pass *p; php_uint32 newcrc32; off_t offset; + int not_really_modified = 0; entry = (phar_entry_info *)data; p = (struct _phar_zip_pass*) arg; @@ -723,6 +722,12 @@ return ZEND_HASH_APPLY_STOP; } + /* we can be modified and already be compressed, such as when chmod() is executed */ + if (entry->flags & PHAR_ENT_COMPRESSION_MASK && (entry->old_flags == entry->flags || !entry->old_flags)) { + not_really_modified = 1; + goto is_compressed; + } + if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0 TSRMLS_CC)) { spprintf(p->error, 0, "unable to seek to start of file \"%s\" to zip-based phar \"%s\"", entry->filename, entry->phar->fname); return ZEND_HASH_APPLY_STOP; @@ -791,6 +796,7 @@ entry->old_flags = entry->flags; entry->is_modified = 1; } else { +is_compressed: central.uncompsize = local.uncompsize = PHAR_SET_32(entry->uncompressed_filesize); central.compsize = local.compsize = PHAR_SET_32(entry->compressed_filesize); @@ -872,7 +878,7 @@ return ZEND_HASH_APPLY_STOP; } - if (entry->is_modified) { + if (!not_really_modified && entry->is_modified) { if (entry->cfp) { if (entry->compressed_filesize != php_stream_copy_to_stream(entry->cfp, p->filefp, entry->compressed_filesize)) { spprintf(p->error, 0, "unable to write compressed contents of file \"%s\" in zip-based phar \"%s\"", entry->filename, entry->phar->fname); @@ -900,6 +906,7 @@ entry->is_modified = 0; } else { + entry->is_modified = 0; if (entry->fp_refcount) { /* open file pointers refer to this fp, do not free the stream */ switch (entry->fp_type) { http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/opendir_edgecases.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/phar/tests/opendir_edgecases.phpt diff -u php-src/ext/phar/tests/opendir_edgecases.phpt:1.4 php-src/ext/phar/tests/opendir_edgecases.phpt:1.5 --- php-src/ext/phar/tests/opendir_edgecases.phpt:1.4 Fri Aug 1 13:36:18 2008 +++ php-src/ext/phar/tests/opendir_edgecases.phpt Sun Aug 31 20:54:27 2008 @@ -19,7 +19,12 @@ $a = opendir('poo'); +$arr = array(); while (false !== ($b = readdir($a))) { + $arr[] = $b; +} +sort($arr); +foreach ($arr as $b) { echo "$b\n"; } http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_buildfromiterator10.phpt?r1=1.5&r2=1.6&diff_format=u Index: php-src/ext/phar/tests/phar_buildfromiterator10.phpt diff -u php-src/ext/phar/tests/phar_buildfromiterator10.phpt:1.5 php-src/ext/phar/tests/phar_buildfromiterator10.phpt:1.6 --- php-src/ext/phar/tests/phar_buildfromiterator10.phpt:1.5 Fri Aug 1 13:36:18 2008 +++ php-src/ext/phar/tests/phar_buildfromiterator10.phpt Sun Aug 31 20:54:27 2008 @@ -30,7 +30,7 @@ __HALT_COMPILER(); ?> --EXPECTF-- -array(33) { +array(35) { ["phar_ctx_001.phpt"]=> string(%d) "%sphar_ctx_001.phpt" ["phar_get_supported_signatures_001.phpt"]=> @@ -97,5 +97,9 @@ string(%d) "%szip%ccorrupt_007.phpt" ["zip/corrupt_008.phpt"]=> string(%d) "%szip%ccorrupt_008.phpt" + ["zip/corrupt_009.phpt"]=> + string(%d) "%szip%ccorrupt_009.phpt" + ["zip/corrupt_010.phpt"]=> + string(%d) "%szip%ccorrupt_010.phpt" } ===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_get_supported_signatures_001.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/phar/tests/phar_get_supported_signatures_001.phpt diff -u php-src/ext/phar/tests/phar_get_supported_signatures_001.phpt:1.3 php-src/ext/phar/tests/phar_get_supported_signatures_001.phpt:1.4 --- php-src/ext/phar/tests/phar_get_supported_signatures_001.phpt:1.3 Fri Aug 1 13:36:18 2008 +++ php-src/ext/phar/tests/phar_get_supported_signatures_001.phpt Sun Aug 31 20:54:27 2008 @@ -1,9 +1,12 @@ --TEST-- Phar::getSupportedSignatures() --SKIPIF-- -<?php if (!extension_loaded("phar")) die("skip"); ?> -<?php if (extension_loaded("hash")) die("skip extension hash conflicts"); ?> -<?php if (extension_loaded("openssl")) die("skip extension openssl loaded"); ?> +<?php +if (!extension_loaded("phar")) die("skip"); +if (extension_loaded("hash")) die("skip extension hash conflicts"); +$arr = Phar::getSupportedSignatures(); +if (in_array("OpenSSL", $arr)) die("skip openssl support enabled"); +?> --INI-- phar.require_hash=0 phar.readonly=0 http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_get_supported_signatures_001a.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/phar/tests/phar_get_supported_signatures_001a.phpt diff -u php-src/ext/phar/tests/phar_get_supported_signatures_001a.phpt:1.2 php-src/ext/phar/tests/phar_get_supported_signatures_001a.phpt:1.3 --- php-src/ext/phar/tests/phar_get_supported_signatures_001a.phpt:1.2 Fri Aug 1 13:36:18 2008 +++ php-src/ext/phar/tests/phar_get_supported_signatures_001a.phpt Sun Aug 31 20:54:27 2008 @@ -1,9 +1,12 @@ --TEST-- Phar::getSupportedSignatures() --SKIPIF-- -<?php if (!extension_loaded("phar")) die("skip"); ?> -<?php if (extension_loaded("hash")) die("skip extension hash conflicts"); ?> -<?php if (!extension_loaded("openssl")) die("skip extension openssl loaded"); ?> +<?php +if (!extension_loaded("phar")) die("skip"); +if (extension_loaded("hash")) die("skip extension hash conflicts"); +$arr = Phar::getSupportedSignatures(); +if (!in_array("OpenSSL", $arr)) die("skip openssl support required"); +?> --INI-- phar.require_hash=0 phar.readonly=0 http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_get_supported_signatures_002.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/phar/tests/phar_get_supported_signatures_002.phpt diff -u php-src/ext/phar/tests/phar_get_supported_signatures_002.phpt:1.3 php-src/ext/phar/tests/phar_get_supported_signatures_002.phpt:1.4 --- php-src/ext/phar/tests/phar_get_supported_signatures_002.phpt:1.3 Fri Aug 1 13:36:18 2008 +++ php-src/ext/phar/tests/phar_get_supported_signatures_002.phpt Sun Aug 31 20:54:27 2008 @@ -4,9 +4,8 @@ <?php if (!extension_loaded("phar")) die("skip"); if (!extension_loaded("hash")) die("skip extension hash required"); -if (extension_loaded("openssl")) die("skip extension openssl loaded"); $arr = Phar::getSupportedSignatures(); -if (in_array("OpenSSL", $arr)) die ("skip native openssl support enabled"); +if (in_array("OpenSSL", $arr)) die ("skip openssl support enabled"); ?> --INI-- phar.require_hash=0 http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_get_supported_signatures_002a.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/phar/tests/phar_get_supported_signatures_002a.phpt diff -u php-src/ext/phar/tests/phar_get_supported_signatures_002a.phpt:1.2 php-src/ext/phar/tests/phar_get_supported_signatures_002a.phpt:1.3 --- php-src/ext/phar/tests/phar_get_supported_signatures_002a.phpt:1.2 Fri Aug 1 13:36:18 2008 +++ php-src/ext/phar/tests/phar_get_supported_signatures_002a.phpt Sun Aug 31 20:54:27 2008 @@ -1,9 +1,12 @@ --TEST-- Phar::getSupportedSignatures() --SKIPIF-- -<?php if (!extension_loaded("phar")) die("skip"); ?> -<?php if (!extension_loaded("hash")) die("skip extension hash required"); ?> -<?php if (!extension_loaded("openssl")) die("skip extension openssl required"); ?> +<?php +if (!extension_loaded("phar")) die("skip"); +if (!extension_loaded("hash")) die("skip extension hash required"); +$arr = Phar::getSupportedSignatures(); +if (!in_array("OpenSSL", $arr)) die("skip openssl support required"); +?> --INI-- phar.require_hash=0 phar.readonly=0 http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phpinfo_004.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/phar/tests/phpinfo_004.phpt diff -u php-src/ext/phar/tests/phpinfo_004.phpt:1.4 php-src/ext/phar/tests/phpinfo_004.phpt:1.5 --- php-src/ext/phar/tests/phpinfo_004.phpt:1.4 Fri Aug 1 13:36:18 2008 +++ php-src/ext/phar/tests/phpinfo_004.phpt Sun Aug 31 20:54:27 2008 @@ -6,7 +6,7 @@ if (!extension_loaded("zlib")) die("skip zlib not loaded"); if (!extension_loaded("bz2")) die("skip bz2 not loaded"); $arr = Phar::getSupportedSignatures(); -if (in_array("OpenSSL", $arr)) die("skip native openssl support enabled"); +if (in_array("OpenSSL", $arr)) die("skip openssl support enabled"); ?> --INI-- phar.readonly=0 http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,13 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a['index.php'] = 'here is my index'; +$a->setStub('<?php +Phar::webPhar(); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller10.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller10.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller10.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller10.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,20 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller10.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller10.phar'); +$a['index.php'] = '<?php +var_dump($_SERVER["PHP_SELF"]); +var_dump($_SERVER["SCRIPT_NAME"]); +var_dump($_SERVER["SCRIPT_FILENAME"]); +var_dump($_SERVER["REQUEST_URI"]); +var_dump($_SERVER["PHAR_PHP_SELF"]); +var_dump($_SERVER["PHAR_SCRIPT_NAME"]); +var_dump($_SERVER["PHAR_SCRIPT_FILENAME"]); +var_dump($_SERVER["PHAR_REQUEST_URI"]); +'; +$a->setStub('<?php +Phar::mungServer(array("PHP_SELF", "SCRIPT_NAME", "SCRIPT_FILENAME", "REQUEST_URI", "OOPSIE")); +Phar::webPhar(); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller11.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller11.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller11.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller11.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,20 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller11.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller11.phar'); +$a['index.php'] = '<?php +var_dump($_SERVER["PHP_SELF"]); +var_dump($_SERVER["SCRIPT_NAME"]); +var_dump($_SERVER["SCRIPT_FILENAME"]); +var_dump($_SERVER["REQUEST_URI"]); +var_dump($_SERVER["PHAR_PHP_SELF"]); +var_dump($_SERVER["PHAR_SCRIPT_NAME"]); +var_dump($_SERVER["PHAR_SCRIPT_FILENAME"]); +var_dump($_SERVER["PHAR_REQUEST_URI"]); +'; +$a->setStub('<?php +Phar::mungServer(array(array(), "SCRIPT_NAME", "SCRIPT_FILENAME", "REQUEST_URI")); +Phar::webPhar(); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller12.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller12.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller12.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller12.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,20 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller12.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller12.phar'); +$a['index.php'] = '<?php +var_dump($_SERVER["PHP_SELF"]); +var_dump($_SERVER["SCRIPT_NAME"]); +var_dump($_SERVER["SCRIPT_FILENAME"]); +var_dump($_SERVER["REQUEST_URI"]); +var_dump($_SERVER["PHAR_PHP_SELF"]); +var_dump($_SERVER["PHAR_SCRIPT_NAME"]); +var_dump($_SERVER["PHAR_SCRIPT_FILENAME"]); +var_dump($_SERVER["PHAR_REQUEST_URI"]); +'; +$a->setStub('<?php +Phar::mungServer(array("PHP_SELF", "SCRIPT_NAME", "SCRIPT_FILENAME", "REQUEST_URI")); +Phar::webPhar(); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller13.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller13.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller13.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller13.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,14 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller13.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller13.phar'); +$a['index.php'] = '<?php +var_dump("test"); +include "oof/test.php";'; +$a['oof/test.php'] = '<?php +var_dump("oof/test.php"); +include "./hi.php";'; +$a['oof/hi.php'] = '<?php +var_dump("hi");'; +$a->setStub('<?php +Phar::webPhar(); +__HALT_COMPILER();'); \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller14.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller14.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller14.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller14.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,19 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller14.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller14.phar'); +$a['html/index.php'] = '<?php +var_dump($_SERVER["PATH_INFO"]); +var_dump($_SERVER["PATH_TRANSLATED"]); +'; +$a->setStub('<?php +function s($a) +{ + return "/html/index.php"; +} +Phar::interceptFileFuncs(); +Phar::mungServer(array("PHP_SELF", "REQUEST_URI")); +Phar::webPhar("whatever", "/html/index.php", null, array(), "s"); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller16.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller16.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller16.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller16.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,16 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller16.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller16.phar'); +$a['index.php'] = '<?php +echo "hi"; +'; +$a->setStub('<?php +try { +Phar::webPhar("test.phar", "/index.php", null, array(), array("fail", "here")); +} catch (Exception $e) { +die($e->getMessage() . "\n"); +} +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller17.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller17.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller17.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller17.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,16 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller17.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller17.phar'); +$a['index.php'] = '<?php +echo "hi"; +'; +$a->setStub('<?php +try { +Phar::webPhar("test.phar", "/index.php", null, array(), "sort"); +} catch (Exception $e) { +die($e->getMessage() . "\n"); +} +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller18.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller18.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller18.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller18.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,19 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller18.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller18.phar'); +$a['index.php'] = '<?php +echo "hi"; +'; +$a->setStub('<?php +function s($a) +{ +} +try { +Phar::webPhar("test.phar", "/index.php", null, array(), "s"); +} catch (Exception $e) { +die($e->getMessage() . "\n"); +} +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller19.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller19.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller19.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller19.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,25 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller19.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller19.phar'); +$a['start/index.php'] = '<?php +echo "start/index.php\n"; +include "./another.php"; +'; +$a['start/another.php'] = '<?php +echo "start/another.php\n"; +include "../another.php"; +?>'; +$a['another.php'] = '<?php +echo "another.php\n"; +?>'; +$a->setStub('<?php +set_include_path("phar://" . __FILE__); +try { +Phar::webPhar("test.phar", "/start/index.php"); +} catch (Exception $e) { +die($e->getMessage() . "\n"); +} +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller2.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller2.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller2.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller2.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,12 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller2.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller2.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a->setStub('<?php +Phar::webPhar("whatever", "a.php"); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller3.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller3.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller3.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller3.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,18 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller3.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller3.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a->setStub('<?php +function s($a) +{ + static $b = array("/hi" => "a.phps"); + if (isset($b[$a])) return $b[$a]; + return $a; +} +Phar::webPhar("whatever", "/index.php", null, array(), "s"); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller4.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller4.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller4.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller4.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,18 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller4.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller4.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a->setStub('<?php +function s($a) +{ + static $b = array("/hi" => false); + if (isset($b[$a])) return $b[$a]; + return $a; +} +Phar::webPhar("whatever", "index.php", null, array(), "s"); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller5.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller5.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller5.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller5.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,12 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller5.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller5.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a->setStub('<?php +Phar::webPhar("whatever", "index.php", null, array(0 => "oops")); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller6.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller6.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller6.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller6.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,12 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller6.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller6.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a->setStub('<?php +Phar::webPhar("whatever", "index.php", null, array("blah" => 100)); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller7.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller7.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller7.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller7.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,12 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller7.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller7.phar'); +$a['a.php'] = 'hio'; +$a['a.jpg'] = 'hio'; +$a['a.phps'] = '<?php function hio(){}'; +$a->setStub('<?php +Phar::webPhar("whatever", "index.php", null, array("blah" => null)); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller8.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller8.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller8.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller8.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,19 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller8.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller8.phar'); +$a['a.phps'] = 'hio1'; +$a['a1.phps'] = '<?php var_dump($_SERVER["REQUEST_URI"], $_SERVER["PATH_INFO"]);'; +$a['a.jpg'] = 'hio2'; +$a['a.php'] = '<?php function hio(){}'; +$a['fronk.gronk'] = 'hio3'; +$a['404.php'] = 'My 404 is rawesome'; +$a['noext'] = 'hi'; +$a['unknown.ext'] = '<?php var_dump("hi");'; +$a['bigfile.txt'] = str_repeat('a', 8193); +$a['fatalerror.phps'] = '<?php oopsie_daisy();'; +$a->setStub('<?php +Phar::webPhar("whatever", "index.php", "404.php", array("jpg" => "foo/bar", "phps" => Phar::PHP, "php" => Phar::PHPS)); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/frontcontroller9.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/frontcontroller9.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/frontcontroller9.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/frontcontroller9.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,14 @@ +<?php +@unlink(dirname(__FILE__) . '/frontcontroller9.phar'); +$a = new Phar(dirname(__FILE__) . '/frontcontroller9.phar'); +$a['a.phps'] = 'hio1'; +$a['a.jpg'] = 'hio2'; +$a['a.php'] = '<?php function hio(){}'; +$a['fronk.gronk'] = 'hio3'; +$a->setStub('<?php +Phar::mungServer(array()); +Phar::webPhar("whatever", "index.php", null, array("jpg" => "foo/bar", "phps" => Phar::PHP, "php" => Phar::PHPS)); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/md5.phar?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/md5.phar http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/nophar.phar?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/nophar.phar diff -u /dev/null php-src/ext/phar/tests/cache_list/files/nophar.phar:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/nophar.phar Sun Aug 31 20:54:28 2008 @@ -0,0 +1,296 @@ +<?php + +$web = 'web.php'; + +if (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) { +Phar::interceptFileFuncs(); +set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path()); +Phar::webPhar(null, $web); +include 'phar://' . __FILE__ . '/' . Extract_Phar::START; +return; +} + +if (@(isset($_SERVER['REQUEST_URI']) && isset($_SERVER['REQUEST_METHOD']) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'POST'))) { +Extract_Phar::go(true); +$mimes = array( +'phps' => 2, +'c' => 'text/plain', +'cc' => 'text/plain', +'cpp' => 'text/plain', +'c++' => 'text/plain', +'dtd' => 'text/plain', +'h' => 'text/plain', +'log' => 'text/plain', +'rng' => 'text/plain', +'txt' => 'text/plain', +'xsd' => 'text/plain', +'php' => 1, +'inc' => 1, +'avi' => 'video/avi', +'bmp' => 'image/bmp', +'css' => 'text/css', +'gif' => 'image/gif', +'htm' => 'text/html', +'html' => 'text/html', +'htmls' => 'text/html', +'ico' => 'image/x-ico', +'jpe' => 'image/jpeg', +'jpg' => 'image/jpeg', +'jpeg' => 'image/jpeg', +'js' => 'application/x-javascript', +'midi' => 'audio/midi', +'mid' => 'audio/midi', +'mod' => 'audio/mod', +'mov' => 'movie/quicktime', +'mp3' => 'audio/mp3', +'mpg' => 'video/mpeg', +'mpeg' => 'video/mpeg', +'pdf' => 'application/pdf', +'png' => 'image/png', +'swf' => 'application/shockwave-flash', +'tif' => 'image/tiff', +'tiff' => 'image/tiff', +'wav' => 'audio/wav', +'xbm' => 'image/xbm', +'xml' => 'text/xml', +); + +header("Cache-Control: no-cache, must-revalidate"); +header("Pragma: no-cache"); + +$basename = basename(__FILE__); +if (!strpos($_SERVER['REQUEST_URI'], $basename)) { +chdir(Extract_Phar::$temp); +include $web; +return; +} +$pt = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $basename) + strlen($basename)); +if (!$pt || $pt == '/') { +$pt = $web; +header('HTTP/1.1 301 Moved Permanently'); +header('Location: ' . $_SERVER['REQUEST_URI'] . '/' . $pt); +exit; +} +$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt); +if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) { +header('HTTP/1.0 404 Not Found'); +echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File ", $pt, " Not Found</h1>\n </body>\n</html>"; +exit; +} +$b = pathinfo($a); +if (!isset($b['extension'])) { +header('Content-Type: text/plain'); +header('Content-Length: ' . filesize($a)); +readfile($a); +exit; +} +if (isset($mimes[$b['extension']])) { +if ($mimes[$b['extension']] === 1) { +include $a; +exit; +} +if ($mimes[$b['extension']] === 2) { +highlight_file($a); +exit; +} +header('Content-Type: ' .$mimes[$b['extension']]); +header('Content-Length: ' . filesize($a)); +readfile($a); +exit; +} +} + +class Extract_Phar +{ +static $temp; +static $origdir; +const GZ = 0x1000; +const BZ2 = 0x2000; +const MASK = 0x3000; +const START = 'index.php'; +const LEN = 6683; + +static function go($return = false) +{ +$fp = fopen(__FILE__, 'rb'); +fseek($fp, self::LEN); +$L = unpack('V', $a = (binary)fread($fp, 4)); +$m = (binary)''; + +do { +$read = 8192; +if ($L[1] - strlen($m) < 8192) { +$read = $L[1] - strlen($m); +} +$last = (binary)fread($fp, $read); +$m .= $last; +} while (strlen($last) && strlen($m) < $L[1]); + +if (strlen($m) < $L[1]) { +die('ERROR: manifest length read was "' . +strlen($m) .'" should be "' . +$L[1] . '"'); +} + +$info = self::_unpack($m); +$f = $info['c']; + +if ($f & self::GZ) { +if (!function_exists('gzinflate')) { +die('Error: zlib extension is not enabled -' . +' gzinflate() function needed for zlib-compressed .phars'); +} +} + +if ($f & self::BZ2) { +if (!function_exists('bzdecompress')) { +die('Error: bzip2 extension is not enabled -' . +' bzdecompress() function needed for bz2-compressed .phars'); +} +} + +$temp = self::tmpdir(); + +if (!$temp || !is_writable($temp)) { +$sessionpath = session_save_path(); +if (strpos ($sessionpath, ";") !== false) +$sessionpath = substr ($sessionpath, strpos ($sessionpath, ";")+1); +if (!file_exists($sessionpath) || !is_dir($sessionpath)) { +die('Could not locate temporary directory to extract phar'); +} +$temp = $sessionpath; +} + +$temp .= '/pharextract/'.basename(__FILE__, '.phar'); +self::$temp = $temp; +self::$origdir = getcwd(); +@mkdir($temp, 0777, true); +$temp = realpath($temp); + +if (!file_exists($temp . DIRECTORY_SEPARATOR . md5_file(__FILE__))) { +self::_removeTmpFiles($temp, getcwd()); +@mkdir($temp, 0777, true); +@file_put_contents($temp . '/' . md5_file(__FILE__), ''); + +foreach ($info['m'] as $path => $file) { +$a = !file_exists(dirname($temp . '/' . $path)); +@mkdir(dirname($temp . '/' . $path), 0777, true); +clearstatcache(); + +if ($path[strlen($path) - 1] == '/') { +@mkdir($temp . '/' . $path, 0777); +} else { +file_put_contents($temp . '/' . $path, self::extractFile($path, $file, $fp)); +@chmod($temp . '/' . $path, 0666); +} +} +} + +chdir($temp); + +if (!$return) { +include self::START; +} +} + +static function tmpdir() +{ +if (strpos(PHP_OS, 'WIN') !== false) { +if ($var = getenv('TMP') ? getenv('TMP') : getenv('TEMP')) { +return $var; +} +if (is_dir('/temp') || mkdir('/temp')) { +return realpath('/temp'); +} +return false; +} +if ($var = getenv('TMPDIR')) { +return $var; +} +return realpath('/tmp'); +} + +static function _unpack($m) +{ +$info = unpack('V', substr($m, 0, 4)); + $l = unpack('V', substr($m, 10, 4)); +$m = substr($m, 14 + $l[1]); +$s = unpack('V', substr($m, 0, 4)); +$o = 0; +$start = 4 + $s[1]; +$ret['c'] = 0; + +for ($i = 0; $i < $info[1]; $i++) { + $len = unpack('V', substr($m, $start, 4)); +$start += 4; + $savepath = substr($m, $start, $len[1]); +$start += $len[1]; + $ret['m'][$savepath] = array_values(unpack('Va/Vb/Vc/Vd/Ve/Vf', substr($m, $start, 24))); +$ret['m'][$savepath][3] = sprintf('%u', $ret['m'][$savepath][3] +& 0xffffffff); +$ret['m'][$savepath][7] = $o; +$o += $ret['m'][$savepath][2]; +$start += 24 + $ret['m'][$savepath][5]; +$ret['c'] |= $ret['m'][$savepath][4] & self::MASK; +} +return $ret; +} + +static function extractFile($path, $entry, $fp) +{ +$data = ''; +$c = $entry[2]; + +while ($c) { +if ($c < 8192) { +$data .= @fread($fp, $c); +$c = 0; +} else { +$c -= 8192; +$data .= @fread($fp, 8192); +} +} + +if ($entry[4] & self::GZ) { +$data = gzinflate($data); +} elseif ($entry[4] & self::BZ2) { +$data = bzdecompress($data); +} + +if (strlen($data) != $entry[0]) { +die("Invalid internal .phar file (size error " . strlen($data) . " != " . +$stat[7] . ")"); +} + +if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) { +die("Invalid internal .phar file (checksum error)"); +} + +return $data; +} + +static function _removeTmpFiles($temp, $origdir) +{ +chdir($temp); + +foreach (glob('*') as $f) { +if (file_exists($f)) { +is_dir($f) ? @rmdir($f) : @unlink($f); +if (file_exists($f) && is_dir($f)) { +self::_removeTmpFiles($f, getcwd()); +} +} +} + +@rmdir($temp); +clearstatcache(); +chdir($origdir); +} +} + +Extract_Phar::go(); +__HALT_COMPILER(); ?> +š+<?php echo "web\n";<?php echo "in b\n";$a = fopen("index.php", "r", true);echo stream_get_contents($a);fclose($a);include dirname(__FILE__) . "/../d";in d +]uñ®šjƽ¹€ +ö8¼Ä·kï\ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/nophar.phar.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/nophar.phar.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/nophar.phar.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/nophar.phar.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,10 @@ +<?php +$fname = dirname(__FILE__) . '/nophar.phar'; +@unlink($fname); +$p = new Phar($fname); +$p['index.php'] = '<?php include "b/c.php";' . "\n"; +$p['web.php'] = '<?php echo "web\n";'; +$p['b/c.php'] = '<?php echo "in b\n";$a = fopen("index.php", "r", true);echo stream_get_contents($a);fclose($a);include dirname(__FILE__) . "/../d";'; +$p['d'] = "in d\n"; +$p->setStub($p->createDefaultStub('index.php', 'web.php')); +?> \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/openssl.phar?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/openssl.phar diff -u /dev/null php-src/ext/phar/tests/cache_list/files/openssl.phar:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/openssl.phar Sun Aug 31 20:54:28 2008 @@ -0,0 +1,292 @@ +<?php + +$web = 'index.php'; + +if (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) { +Phar::interceptFileFuncs(); +set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path()); +Phar::webPhar(null, $web); +include 'phar://' . __FILE__ . '/' . Extract_Phar::START; +return; +} + +if (@(isset($_SERVER['REQUEST_URI']) && isset($_SERVER['REQUEST_METHOD']) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'POST'))) { +Extract_Phar::go(true); +$mimes = array( +'phps' => 2, +'c' => 'text/plain', +'cc' => 'text/plain', +'cpp' => 'text/plain', +'c++' => 'text/plain', +'dtd' => 'text/plain', +'h' => 'text/plain', +'log' => 'text/plain', +'rng' => 'text/plain', +'txt' => 'text/plain', +'xsd' => 'text/plain', +'php' => 1, +'inc' => 1, +'avi' => 'video/avi', +'bmp' => 'image/bmp', +'css' => 'text/css', +'gif' => 'image/gif', +'htm' => 'text/html', +'html' => 'text/html', +'htmls' => 'text/html', +'ico' => 'image/x-ico', +'jpe' => 'image/jpeg', +'jpg' => 'image/jpeg', +'jpeg' => 'image/jpeg', +'js' => 'application/x-javascript', +'midi' => 'audio/midi', +'mid' => 'audio/midi', +'mod' => 'audio/mod', +'mov' => 'movie/quicktime', +'mp3' => 'audio/mp3', +'mpg' => 'video/mpeg', +'mpeg' => 'video/mpeg', +'pdf' => 'application/pdf', +'png' => 'image/png', +'swf' => 'application/shockwave-flash', +'tif' => 'image/tiff', +'tiff' => 'image/tiff', +'wav' => 'audio/wav', +'xbm' => 'image/xbm', +'xml' => 'text/xml', +); + +header("Cache-Control: no-cache, must-revalidate"); +header("Pragma: no-cache"); + +$basename = basename(__FILE__); +if (!strpos($_SERVER['REQUEST_URI'], $basename)) { +chdir(Extract_Phar::$temp); +include $web; +return; +} +$pt = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $basename) + strlen($basename)); +if (!$pt || $pt == '/') { +$pt = $web; +header('HTTP/1.1 301 Moved Permanently'); +header('Location: ' . $_SERVER['REQUEST_URI'] . '/' . $pt); +exit; +} +$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt); +if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) { +header('HTTP/1.0 404 Not Found'); +echo "<html>\n <head>\n <title>File Not Found<title>\n </head>\n <body>\n <h1>404 - File ", $pt, " Not Found</h1>\n </body>\n</html>"; +exit; +} +$b = pathinfo($a); +if (!isset($b['extension'])) { +header('Content-Type: text/plain'); +header('Content-Length: ' . filesize($a)); +readfile($a); +exit; +} +if (isset($mimes[$b['extension']])) { +if ($mimes[$b['extension']] === 1) { +include $a; +exit; +} +if ($mimes[$b['extension']] === 2) { +highlight_file($a); +exit; +} +header('Content-Type: ' .$mimes[$b['extension']]); +header('Content-Length: ' . filesize($a)); +readfile($a); +exit; +} +} + +class Extract_Phar +{ +static $temp; +static $origdir; +const GZ = 0x1000; +const BZ2 = 0x2000; +const MASK = 0x3000; +const START = 'index.php'; +const LEN = 6685; + +static function go($return = false) +{ +$fp = fopen(__FILE__, 'rb'); +fseek($fp, self::LEN); +$L = unpack('V', $a = (binary)fread($fp, 4)); +$m = (binary)''; + +do { +$read = 8192; +if ($L[1] - strlen($m) < 8192) { +$read = $L[1] - strlen($m); +} +$last = (binary)fread($fp, $read); +$m .= $last; +} while (strlen($last) && strlen($m) < $L[1]); + +if (strlen($m) < $L[1]) { +die('ERROR: manifest length read was "' . +strlen($m) .'" should be "' . +$L[1] . '"'); +} + +$info = self::_unpack($m); +$f = $info['c']; + +if ($f & self::GZ) { +if (!function_exists('gzinflate')) { +die('Error: zlib extension is not enabled -' . +' gzinflate() function needed for zlib-compressed .phars'); +} +} + +if ($f & self::BZ2) { +if (!function_exists('bzdecompress')) { +die('Error: bzip2 extension is not enabled -' . +' bzdecompress() function needed for bz2-compressed .phars'); +} +} + +$temp = self::tmpdir(); + +if (!$temp || !is_writable($temp)) { +$sessionpath = session_save_path(); +if (strpos ($sessionpath, ";") !== false) +$sessionpath = substr ($sessionpath, strpos ($sessionpath, ";")+1); +if (!file_exists($sessionpath) || !is_dir($sessionpath)) { +die('Could not locate temporary directory to extract phar'); +} +$temp = $sessionpath; +} + +$temp .= '/pharextract/'.basename(__FILE__, '.phar'); +self::$temp = $temp; +self::$origdir = getcwd(); +@mkdir($temp, 0777, true); +$temp = realpath($temp); + +if (!file_exists($temp . DIRECTORY_SEPARATOR . md5_file(__FILE__))) { +self::_removeTmpFiles($temp, getcwd()); +@mkdir($temp, 0777, true); +@file_put_contents($temp . '/' . md5_file(__FILE__), ''); + +foreach ($info['m'] as $path => $file) { +$a = !file_exists(dirname($temp . '/' . $path)); +@mkdir(dirname($temp . '/' . $path), 0777, true); +clearstatcache(); + +if ($path[strlen($path) - 1] == '/') { +@mkdir($temp . '/' . $path, 0777); +} else { +file_put_contents($temp . '/' . $path, self::extractFile($path, $file, $fp)); +@chmod($temp . '/' . $path, 0666); +} +} +} + +chdir($temp); + +if (!$return) { +include self::START; +} +} + +static function tmpdir() +{ +if (strpos(PHP_OS, 'WIN') !== false) { +if ($var = getenv('TMP') ? getenv('TMP') : getenv('TEMP')) { +return $var; +} +if (is_dir('/temp') || mkdir('/temp')) { +return realpath('/temp'); +} +return false; +} +if ($var = getenv('TMPDIR')) { +return $var; +} +return realpath('/tmp'); +} + +static function _unpack($m) +{ +$info = unpack('V', substr($m, 0, 4)); + $l = unpack('V', substr($m, 10, 4)); +$m = substr($m, 14 + $l[1]); +$s = unpack('V', substr($m, 0, 4)); +$o = 0; +$start = 4 + $s[1]; +$ret['c'] = 0; + +for ($i = 0; $i < $info[1]; $i++) { + $len = unpack('V', substr($m, $start, 4)); +$start += 4; + $savepath = substr($m, $start, $len[1]); +$start += $len[1]; + $ret['m'][$savepath] = array_values(unpack('Va/Vb/Vc/Vd/Ve/Vf', substr($m, $start, 24))); +$ret['m'][$savepath][3] = sprintf('%u', $ret['m'][$savepath][3] +& 0xffffffff); +$ret['m'][$savepath][7] = $o; +$o += $ret['m'][$savepath][2]; +$start += 24 + $ret['m'][$savepath][5]; +$ret['c'] |= $ret['m'][$savepath][4] & self::MASK; +} +return $ret; +} + +static function extractFile($path, $entry, $fp) +{ +$data = ''; +$c = $entry[2]; + +while ($c) { +if ($c < 8192) { +$data .= @fread($fp, $c); +$c = 0; +} else { +$c -= 8192; +$data .= @fread($fp, 8192); +} +} + +if ($entry[4] & self::GZ) { +$data = gzinflate($data); +} elseif ($entry[4] & self::BZ2) { +$data = bzdecompress($data); +} + +if (strlen($data) != $entry[0]) { +die("Invalid internal .phar file (size error " . strlen($data) . " != " . +$stat[7] . ")"); +} + +if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) { +die("Invalid internal .phar file (checksum error)"); +} + +return $data; +} + +static function _removeTmpFiles($temp, $origdir) +{ +chdir($temp); + +foreach (glob('*') as $f) { +if (file_exists($f)) { +is_dir($f) ? @rmdir($f) : @unlink($f); +if (file_exists($f) && is_dir($f)) { +self::_removeTmpFiles($f, getcwd()); +} +} +} + +@rmdir($temp); +clearstatcache(); +chdir($origdir); +} +} + +Extract_Phar::go(); +__HALT_COMPILER(); ?>H\ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/openssl.phar.pubkey?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/openssl.phar.pubkey diff -u /dev/null php-src/ext/phar/tests/cache_list/files/openssl.phar.pubkey:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/openssl.phar.pubkey Sun Aug 31 20:54:28 2008 @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDA3ADUiKZIEhekYShzPCZ3LFbg +rDuV44jH94OdJQfqaCQBvZXqMoG1bWOeYfbc3iO0gHWW3SKB27Sf1ZBnc5c1+YzB +mx9bFipOX2W2ouKS2YoHeIoR9leDNu4yqwBsuggFPGVPxM9ikEI+YAOGVTCd4mV5 +agpkVsHLNJWbz/nPVwIDAQAB +-----END PUBLIC KEY----- http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/phar_oo_test.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/phar_oo_test.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/phar_oo_test.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/phar_oo_test.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,49 @@ +<?php + +ini_set('date.timezone', 'GMT'); + +$fname = dirname(__FILE__) . '/phar_oo_test.phar.php'; +$pname = 'phar://' . $fname; +$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>'; + +$files = array(); + +if (!isset($pharconfig)) $pharconfig = 0; + +switch($pharconfig) +{ + default: + case 0: + $files['a.php'] = '<?php echo "This is a.php\n"; ?>'; + $files['b.php'] = '<?php echo "This is b.php\n"; ?>'; + $files['b/c.php'] = '<?php echo "This is b/c.php\n"; ?>'; + $files['b/d.php'] = '<?php echo "This is b/d.php\n"; ?>'; + $files['e.php'] = '<?php echo "This is e.php\n"; ?>'; + break; + case 1: + $files['a.csv'] =<<<EOF +1,2,3 +2,a,b +3,"c","'e'" +EOF; + break; + case 2: + $files['a.csv'] =<<<EOF +1,2,3 +2,a,b +3,"c","'e'" +4 +5,5 + +7,777 +EOF; + break; + case 3: + $files['a.php'] = '<?php echo new new class;'; + break; +} + +$ftime = mktime(12, 0, 0, 3, 1, 2006); +include 'phar_test.inc'; + +?> \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/phar_test.inc?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/phar_test.inc diff -u /dev/null php-src/ext/phar/tests/cache_list/files/phar_test.inc:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/phar_test.inc Sun Aug 31 20:54:28 2008 @@ -0,0 +1,78 @@ +<?php + +if (function_exists('date_default_timezone_set')) { + date_default_timezone_set('UTC'); +} + +$manifest = (binary)''; +$glags = 0; + +foreach($files as $name => $cont) +{ + global $gflags, $files; + + $comp = NULL; + $crc32= NULL; + $clen = NULL; + $ulen = NULL; + $time = isset($ftime) ? $ftime : @mktime(12, 0, 0, 3, 1, 2006); + $flags= 0; + $perm = 0x000001B6; + $meta = NULL; + + // overwrite if array + if (is_array($cont)) + { + foreach(array('comp','crc32','clen','ulen','time','flags','perm','meta','cont') as $what) + { + if (isset($cont[$what])) + { + $$what = $cont[$what]; + } + } + } + + // create if not yet done + if (empty($comp)) $comp = $cont; + if (empty($ulen)) $ulen = strlen($cont); + if (empty($clen)) $clen = strlen($comp); + if (empty($crc32))$crc32= crc32((binary)$cont); + if (isset($meta)) $meta = serialize($meta); + + // write manifest entry + $manifest .= pack('V', strlen($name)) . (binary)$name; + $manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta; + + // globals + $gflags |= $flags; + $files[$name] = $comp; +} + +if (!isset($alias)) $alias = 'hio'; + +if (isset($pmeta)) $pmeta = serialize($pmeta); else $pmeta = ''; + +$manifest = pack('VnVV', count($files), isset($hasdir) ? 0x1110 : 0x1000, $gflags, strlen($alias)) . (binary)$alias . pack('V', strlen($pmeta)) . (binary)$pmeta . $manifest; +$file = (binary)$file; +$file .= pack('V', strlen($manifest)) . $manifest; + +foreach($files as $cont) +{ + $file .= (binary)$cont; +} + +file_put_contents($fname, $file); + +if (@$gzip) { + $fp = gzopen($fname, 'w'); + fwrite($fp, $file); + fclose($fp); +} + +if (@$bz2) { + $fp = bzopen($fname, 'w'); + fwrite($fp, $file); + fclose($fp); +} + +?> \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/private.pem?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/private.pem diff -u /dev/null php-src/ext/phar/tests/cache_list/files/private.pem:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/cache_list/files/private.pem Sun Aug 31 20:54:28 2008 @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQDA3ADUiKZIEhekYShzPCZ3LFbgrDuV44jH94OdJQfqaCQBvZXq +MoG1bWOeYfbc3iO0gHWW3SKB27Sf1ZBnc5c1+YzBmx9bFipOX2W2ouKS2YoHeIoR +9leDNu4yqwBsuggFPGVPxM9ikEI+YAOGVTCd4mV5agpkVsHLNJWbz/nPVwIDAQAB +AoGAGiS4qBbuE48ATXQuO5DH1hfYnxQ575Oskw7mdIL0k74SQ3ojvF+kXae6fVni +UQZ76JgRWKYZa2kRDymwLZXpxVbiGL9dDvQY8ZENDtWOy9s7TDtxNixbZloKBopg +J7G1B05LgetR3dgFnQOwt+e3kOu72RpS7thyBaUm8zHCRSECQQDw+h5uxE7i9CC8 +KHyJlwGoR28KZgrSpo74yWhQ+b1lzxQ+rk2wToFD/p+WNe/nf78YUl/cq0LngCKH +Y7t228VLAkEAzOHzAjuDlGGzK6Kpe67iKgXd+GpKwPr9iaFfmzABOkRwQug4LCN7 +skmzCX5pzxqMZW1xNICjeDjWsMA3d4EypQJBAJyXPA1onYaXc2oxuPPD3/zVJpAQ +TTojp8Z9Qr9T+kJdNV+h7rQB37gqjtOSiynY9nm8lbSUya4bstRd96S+HU8CQQCp +yBAd6H2oZ7IXVeuHACyRUF1ab5LVCukxtVXJ/2T1CSPSfieWhC0MWMCR/HzoUALK +RoBKVtOgW9GllRQh5yG1AkARVYbvj0XBy6XUpe5WZsLNWwpw1JreRsygcPXYh8bs +nxhCdHNHJQ01lRDMjvNLtI8a5YjJE/IeW76T2mPCiJZI +-----END RSA PRIVATE KEY----- http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/sha1.phar?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/sha1.phar http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/sha256.phar?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/sha256.phar http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/sha512.phar?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/sha512.phar http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/cache_list/files/zfapp.tgz?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/cache_list/files/zfapp.tgz http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/bzip2.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/zip/bzip2.phpt diff -u /dev/null php-src/ext/phar/tests/zip/bzip2.phpt:1.2 --- /dev/null Sun Aug 31 20:54:28 2008 +++ php-src/ext/phar/tests/zip/bzip2.phpt Sun Aug 31 20:54:28 2008 @@ -0,0 +1,80 @@ +--TEST-- +Phar: process bzip2-compressed zip entry +--SKIPIF-- +<?php if (!extension_loaded("phar")) die("skip"); ?> +<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?> +<?php if (!extension_loaded("bz2")) die("skip bz2 not available"); ?> +--FILE-- +<?php +try { + $a = new PharData(dirname(__FILE__) . '/files/bzip2.zip'); + foreach ($a as $entry => $file) { + echo $file->getContent(); + } +} catch (Exception $e) { + echo $e->getMessage() . "\n"; +} +?> +===DONE=== +--EXPECT-- +<?php +include dirname(__FILE__) . '/corrupt_zipmaker.php.inc'; +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii'); +$a->addFile('hi2', null, 'hii2', null, null, 'encrypt', 'encrypt'); +$a->writeZip(dirname(__FILE__) . '/encrypted.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii'); +$a->addFile('', null, 'stdin'); +$a->writeZip(dirname(__FILE__) . '/stdin.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hii', null, 'hii', null, null, 'filename_len', 'filename_len'); +$a->addFile('hi', null, 'hii'); +$a->writeZip(dirname(__FILE__) . '/truncfilename.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress'); +$a->writeZip(dirname(__FILE__) . '/compress_unsup1.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 2); +$a->writeZip(dirname(__FILE__) . '/compress_unsup2.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 3); +$a->writeZip(dirname(__FILE__) . '/compress_unsup3.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 4); +$a->writeZip(dirname(__FILE__) . '/compress_unsup4.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 5); +$a->writeZip(dirname(__FILE__) . '/compress_unsup5.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 6); +$a->writeZip(dirname(__FILE__) . '/compress_unsup6.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 7); +$a->writeZip(dirname(__FILE__) . '/compress_unsup7.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 9); +$a->writeZip(dirname(__FILE__) . '/compress_unsup9.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 10); +$a->writeZip(dirname(__FILE__) . '/compress_unsup10.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 14); +$a->writeZip(dirname(__FILE__) . '/compress_unsup14.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 18); +$a->writeZip(dirname(__FILE__) . '/compress_unsup18.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 19); +$a->writeZip(dirname(__FILE__) . '/compress_unsup19.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 97); +$a->writeZip(dirname(__FILE__) . '/compress_unsup97.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 98); +$a->writeZip(dirname(__FILE__) . '/compress_unsup98.zip'); +$a = new corrupt_zipmaker; +$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 11); +$a->writeZip(dirname(__FILE__) . '/compress_unsupunknown.zip'); +?> +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/files/bzip2.zip?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/zip/files/bzip2.zip
« previous php.cvs (#52857) next »