Commit Graph

153 Commits

Author SHA1 Message Date
Greg Beaver
de5238a3bc minor refactoring to remove 1 call to zend_get_executed_filename() 2008-02-11 06:49:22 +00:00
Greg Beaver
78e8eb3900 major refactoring of internal handling of aliases.
1) rename is_explicit_alias to is_temporary_alias for clarity and flip the value
2) fix setAlias so that it sets a permanent to-be-saved alias, and restores the old one on error
3) fix Phar constructor to work with sub-directories in RecursiveDirectoryIterator
2008-02-11 06:46:44 +00:00
Greg Beaver
3874e12ee5 fix 5.2 build 2008-02-11 04:48:58 +00:00
Antony Dovgal
6d9453aa91 add ifdefs and fix folding 2008-02-08 09:25:02 +00:00
Antony Dovgal
271e0394d7 fix 5_3 build 2008-02-08 09:21:24 +00:00
Greg Beaver
c31f04b5f3 SEPARATE_ZVAL does not work for this situation. We always want
to duplicate and copy, so do it manually and reset refcount to 1
2008-02-08 03:53:17 +00:00
Greg Beaver
a3c910739f fix flipped logic 2008-02-08 01:08:02 +00:00
Greg Beaver
43f2638634 better fix for invalid mem access 2008-02-08 00:58:39 +00:00
Greg Beaver
7575b012f2 fix invalid read/write if strstr() returns NULL 2008-02-08 00:55:38 +00:00
Greg Beaver
e67c584348 [DOC]
refactor the $rewrites parameter in Phar::webPhar.  Now it is a callback
that accepts the path requested.  This callback should return the actual filename
requested as a string, or false to deny access as HTTP 403.
Also fix incorrect munging of SCRIPT_NAME variable in mungServer
More importantly, Phar::webPhar now finds the filename hidden in:
http://localhost/myphar.phar/internal/file.php/extra/stuff
as 'internal/file.php' in phar 'myphar.phar' with REQUEST_URI '/internal/file.php/extra/stuff'
this will allow pharring up apps that use REQUEST_URI for front controller stuff.
2008-02-07 23:42:03 +00:00
Greg Beaver
1cac0aa8e2 fix webPhar() in CGI sapi, update tests to reflect reality of how these ENV vars are passed 2008-02-07 04:24:58 +00:00
Greg Beaver
2b9a4279dd fix logic of path redirection. always prepend index_php with "/" if it doesn't have it,
and then if path_info ends with "/" just use entry + 1
2008-02-02 05:20:37 +00:00
Greg Beaver
47320359e9 remove unused variable, eliminate an invalid read reported by valgrind 2008-02-01 19:50:06 +00:00
Antony Dovgal
addf32d7d9 we don't want to modify the pointer contents, we just want to change the pointer itself 2008-02-01 11:25:59 +00:00
Marcus Boerger
7d3758fa08 - SPL has been changed 2008-01-30 23:50:23 +00:00
Marcus Boerger
33dc86c435 - Fixed glob:// stream handling in (Recursive)DirectoryIterator. 2008-01-30 20:31:09 +00:00
Greg Beaver
f4e4ad0cd1 fix PharFileInfo->setAlias (was wildly broken)
fix directory creation in zip archives
update zip tests to use phar to create the zip, and then copy to a new file
2008-01-28 20:18:15 +00:00
Steph Fox
9fd5c0b438 - Moved phar_unixify_path_separators() to a single central point
- The last two VC 6 compiler warnings gone. Please test under *nix.
2008-01-28 14:39:17 +00:00
Greg Beaver
6cdabede4c remove ext/zip dependency entirely, write better native zip support
re-organize, create util.c, move entry_info/archive_data/entry_data access methods to this file
refactor entry->fp, now this is abstracted with phar_get_efp() and phar_seek_efp(), fixes all weird dependency issues
permanently solve the "millions of file pointers" issue for read access.  All compressed files are read into a single
temporary stream, and their constraints are controlled by the entry->fp abstraction

Improvements in this zip implementation over ext/zip:
 * full read/write support for bzip2 compressed files
 * much more efficient access for accessing only a few files within large zip files, as crc/header validation is
   done just-in-time
 * full stream support for opendir/rename/rmdir/mkdir as well as all of the other stream funcs
 * full support for setting file perms via Phar::chmod(), stored as zip-standard extra field
 * no problem with large zips and many open file pointers

# TODO: add big-endian system support for tar/zip file format headers, otherwise the implementation is complete
# TODO: test on windows and fix any windows-specific issues
# TODO: verify zips created work with unzip/winzip/windows explorer and so on
2008-01-28 08:52:08 +00:00
Steph Fox
69afbc1099 "What helly said" 2008-01-25 16:05:26 +00:00
Steph Fox
61c3a60815 Make all possible build combinations work under doze (external zip library) 2008-01-25 15:00:24 +00:00
Greg Beaver
b2412c4568 fix problems found while documenting. Throw consistent exceptions, chmod is not allowed on
temporary directories, but is allowed on regular ones
allow uncompressAllFiles() to decompress a gzip/bzipped tar archive
fix some protos
2008-01-21 05:28:09 +00:00
Greg Beaver
117f5e2639 add web-based support for default stub, now phars written with webPhar() will work
out of the box regardless of server configuration with phar file format
split up stub.h strings into 2046 byte chunks because MS VC 6 is friggin stupid
2008-01-20 00:49:45 +00:00
Greg Beaver
d583fae0cc add Phar::createDefaultStub(), which can take as an argument the filename
that should be loaded as a "bootstrap" for the phar archive
2008-01-19 04:26:22 +00:00
Greg Beaver
9a59e60657 remove HAVE_ZIP defines just as we removed HAVE_BZ2 defines and for the same reason
update outdated description of phar in config.m4
make zip extension mandatory on windows for compiling purposes
2008-01-17 03:59:07 +00:00
Greg Beaver
a3718dcfa3 no need to use conditional defines for bz2, we don't call it except indirectly through stream wrappers.
After removing HAVE_BZ2 conditionals, phar works even if bz2 is not present on installation through pecl
2008-01-17 03:48:29 +00:00
Greg Beaver
0e934c70d7 add optional whole-file compression to convertToTar/convertToPhar 2008-01-16 21:09:32 +00:00
Greg Beaver
31ed60001c fix build on windows 2008-01-16 20:17:47 +00:00
Greg Beaver
d1eda9c8ac add Phar::convertToTar(), Phar::convertToZip(), and Phar::convertToPhar() 2008-01-16 07:24:39 +00:00
Greg Beaver
cb40b39b5b add support for creation of gzipped and bzipped tar-based phars 2008-01-15 23:41:44 +00:00
Greg Beaver
ab99c77a5e add a whole slew of missing returns after throwing an exception, and remove 1 spurious return after RETURN_TRUE 2008-01-14 05:12:46 +00:00
Greg Beaver
f5e4ff21dd fix segfault in Phar::mungServer() found in frontcontroller20.phpt 2008-01-12 22:21:50 +00:00
Greg Beaver
56e84a390c fix segfault in Phar::webPhar() if file is in root directory, found in frontcontroller16.phpt 2008-01-12 22:16:00 +00:00
Greg Beaver
4df43510b9 make zip optional 2008-01-12 05:17:12 +00:00
Greg Beaver
e9ee7dbfc5 fix compile on windows
remove internal libzip
add required dep on zip (will make optional in a few minutes)
2008-01-12 04:32:19 +00:00
Greg Beaver
36f3d80779 stupid windows doesn't allow varargs macros, so remove it. remove unused variable 2008-01-11 07:39:02 +00:00
Greg Beaver
8fb4205a8d add Phar::interceptFileFuncs()
To intercept fopen(), file_get_contents(), opendir(), and all the stat-based functions so that
code like "if (is_readable('./config.inc.php'))" actually works inside of a phar
[DOC]
2008-01-11 07:30:03 +00:00
Greg Beaver
a38e4ff9a7 always mung PATH_INFO and PATH_TRANSLATED, fix segfault if tar-based phar has no stub 2008-01-11 02:52:13 +00:00
Greg Beaver
ab4c2caf4b add interception of is_dir(), file_exists() and file_get_contents() - will make these optional shortly 2008-01-10 15:13:00 +00:00
Greg Beaver
f6b16061d1 implement whole-file compression of phars for phar/tar-based phars
still not 100% working, add failing test
add Phar::isCompressed(), which returns either 0, Phar::GZ, or Phar::BZ2
[DOC]
2008-01-09 07:09:04 +00:00
Greg Beaver
9f5b3a229f fix empty directories in phar, add test 2008-01-09 00:58:37 +00:00
Greg Beaver
1a3624494e implement mkdir (compiles, not yet tested), support for empty directories in phar (not yet tested)
revert last commit of efree(), it's necessary.
2008-01-08 22:14:16 +00:00
Greg Beaver
b93b48663d complete set of new tests for zip-based phars (need to test compression for zip-based phars)
fix a whole bunch of zip-related bugs
tar tests need some naming
add phar information to error messages, fix existing tests to reflect this
2008-01-08 07:08:46 +00:00
Greg Beaver
36efc2a907 eliminate potential double-free of alias
major improvement of zip/tar-based phar stub execution, now __FILE__ says it is the phar, and not phar/.phar/stub.php,
so that the same stub can be used for phar or tar/zip-based phars
ridiculous speedup of rename() within a phar (something like 1000%)
last of the tar-based phar fixes
new tests for tar-based phars, fix existing tests to use new format of __FILE__
2008-01-07 22:21:10 +00:00
Greg Beaver
71f6ae0be5 fix segfault (now all existing tests pass 2008-01-07 17:31:53 +00:00
Greg Beaver
ed312a7a05 fix segfault (duh, can't free something that was not initialized) 2008-01-07 17:28:45 +00:00
Greg Beaver
8a46146f37 fix stat of directory in tar/zip
improve phar recognition of tar/zip-based phars in phar_compile_file
fix segfault in Phar::webPhar() with invalid redirect
add Phar->isTar()/isZip()/isPhar() to determine internal file format
fix creation of tar-based phars from filename in some circumstances
fix read of corrupted file contents from a tar if the tar had been opened readonly and then modified
ensure directories are marked with is_dir in tar file format entries
copy fp_refcount logic into phar_tar_flush() from phar_flush()
fix segfault when flushing a tar with a new stub/alias
2008-01-07 05:41:09 +00:00
Greg Beaver
bd0d9e8de3 remove mung server list hash destroy, this is done in shutdown 2008-01-05 22:48:06 +00:00
Greg Beaver
2410cc96b6 complete tests for Phar::mungServer 2008-01-05 22:02:33 +00:00
Greg Beaver
efc22a3726 new tests, fix mime type overrides (all web front controller primary features are now tested and working for regular phar files) 2008-01-05 06:14:43 +00:00