Commit Graph

36 Commits

Author SHA1 Message Date
Steph Fox
8343d7c139 - A bit more work on PharData creation/conversion.
- If readonly=0, why not $phardata->convertToPhar()?
- Known issue with directories creating 'as-file' copies within the archive (all formats)
@Greg/Marcus/Tony: This passes all tests on my box, 5.2/5.3/release_ts/debug_ts, and I can't find any more memleaks. Obviously this is too good to be true, so if conversion is still messy elsewhere please feel free to fix, or bug and assign to me.
2008-03-03 08:41:15 +00:00
Antony Dovgal
cd858fe243 fix segfault, comment out useless line 2008-02-29 13:56:46 +00:00
Steph Fox
001ffec19f Initial support for PharData object.
Note: two tests currently fail. IMHO we should be throwing E_ERROR on encountering a corrupted archive, not trying to throw a trail of exceptions...
New tests still to be written, not all functionality is in place yet.
2008-02-27 21:34:26 +00:00
Steph Fox
8513db73bb A bunch of stuff to do with filename conversion. Hopefully it won't sink the ship. 2008-02-24 22:29:06 +00:00
Greg Beaver
588f0660e9 free mounted_dirs on error to avoid memleak 2008-02-23 21:29:57 +00:00
Greg Beaver
2eb4db8d79 best fix for the bad logic in tar.c, now all tests pass that should 2008-02-23 18:17:48 +00:00
Greg Beaver
18444e3b5a revert previous changes to tar.c, fix incorrect user_stub == dummy check, now things work that should 2008-02-23 18:14:44 +00:00
Greg Beaver
a561228843 revert previous changes to tar.c, fix incorrect user_stub == dummy check, now things work that should 2008-02-23 18:09:31 +00:00
Greg Beaver
9d9bd2715a that !zend_hash_exists should be zend_hash_exists 2008-02-23 15:07:02 +00:00
Greg Beaver
a1828999c5 fix unfreed stuff when adding default stub 2008-02-23 15:05:05 +00:00
Steph Fox
eb7565451d s/zip/tar 2008-02-21 14:27:19 +00:00
Steph Fox
6cc2426ff1 A much better solution for setDefaultStub(). The convertTo*() fixes should be trivial now. 2008-02-21 00:24:38 +00:00
Greg Beaver
ba9fcf62fc add initial support for hashing mounted directories. Actual matching of mounted directories is not yet supported. 2008-02-18 04:45:42 +00:00
Steph Fox
87626d56d2 Fix ZTS build *nicely* 2008-02-18 04:42:04 +00:00
Greg Beaver
f72ce59e95 remove refcount hack to workaround zlib memleak fixed in zlib
intercepted file functions now fall through if the file is not found in the phar, this allows access to external libraries
actually use include_path for locating files for inclusion and in file_get_contents/fopen when include_path is requested.
This allows applications like Zend Framework MVC implementation to function properly
2008-02-13 15:00:31 +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
Greg Beaver
19df8a4d7f fix issues in opendir() with empty directories within a phar archive, port filterparams fix to tar.c 2008-02-08 05:57:40 +00:00
Greg Beaver
e3c64bd53b fix memory leaks. There are some leaks in libz that I can't fix, but none triggered in the current tests 2008-02-08 04:26:41 +00:00
Greg Beaver
67a9fd8783 fix mem leaks
strip trailing slash if present in a directory entry.  This code assumes that
tar_type is directory, as it must be to be a valid directory.
2008-02-08 01:06:12 +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
Greg Beaver
34bb2d7e76 unixify path separators in tar-based phars, always use this value for duping alias
# found by delete.phpt unit test.  I love unit tests
2008-01-14 06:19:43 +00:00
Greg Beaver
9bcbbce5bf add definitions for MAX_WBITS in case it isn't defined 2008-01-12 16:15:17 +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
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
21ab2ca8e9 fix gzipped phars in phar file format, add test 2008-01-09 08:45: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
abde85c420 add rmdir() support, add rmdir to dir test
fix *extremely* ancient problem where phar_wrapper_stat always returned success indicating the file existed
rename phar_destroy_manifest to phar_destroy_manifest_entry
2008-01-09 03:47:22 +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
d9d91f424b fp must be nulled on every write also when == phar->fp or we get stale fp and problems. add new test that unearthed this problem 2008-01-07 17:58:31 +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
f589855093 fix tar-based phars creation and loading 2008-01-03 18:13:27 +00:00
Greg Beaver
c83b566218 commit missing files (helps if you cvs add, don't it?) for tar implementation 2008-01-03 05:35:19 +00:00