Commit Graph

888 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
Steph Fox
1cdade809b Going back to square one ("it works on Scott's box" - OSX 10.5, gcc version 4.0.1 (Apple Inc. build 5465)). Thanks ScottMac, David C and Philip for testing...
Possibly a gcc version issue?
2008-03-02 00:42:29 +00:00
Steph Fox
5c2be9551b Should work on all platforms now. (Testing.) 2008-03-01 22:38:10 +00:00
Steph Fox
d4cf7e47f6 Right problem, wrong solution. Also missed an '= 1' , thanks Marcus 2008-03-01 22:28:33 +00:00
Steph Fox
f96cd8fbc3 Tested this time. All's fine here, MacOSX still complaining @ present. 2008-03-01 22:04:19 +00:00
Steph Fox
66d3abac02 Untested. Killing remaining warnings under MacOSX (thanks again Philip). 2008-03-01 21:44:32 +00:00
Steph Fox
15fefd3692 All tests pass here now. Thanks Philip for reporting compiler errors that don't show on my setup. 2008-03-01 21:31:03 +00:00
Antony Dovgal
cd858fe243 fix segfault, comment out useless line 2008-02-29 13:56:46 +00:00
Steph Fox
ad0a7679ac Kill an unnecessary bit of internal docu and add 'compression' to the TODO 2008-02-28 02:09:49 +00:00
Steph Fox
413df68971 Forgot to return... not that I understand this stuff... 2008-02-28 01:16:43 +00:00
Steph Fox
9e61358eda Allow alias for phar.tar/phar.zip 2008-02-28 01:08:34 +00:00
Steph Fox
dd5196cf01 Update TODO 2008-02-27 21:41:59 +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
6a63b3921e Update protos. 2008-02-25 16:27:23 +00:00
Steph Fox
eaef0319d2 Make it possible to read the TODO file on a laptop :) 2008-02-25 16:15:57 +00:00
Steph Fox
4b849dcac6 Lunchbreak III 2008-02-25 15:44:21 +00:00
Steph Fox
d712008ba7 Lunchbreak II 2008-02-25 15:43:14 +00:00
Steph Fox
303b72fed3 Lunchbreak. 2008-02-25 15:41:47 +00:00
Steph Fox
f5ab70a3b9 Update reflection info 2008-02-25 12:21:19 +00:00
Steph Fox
1a3bf3619f Leftover from experimenting with zend_hash_del... 2008-02-25 11:37:08 +00:00
Greg Beaver
2d36a89d83 update TODO 2008-02-25 04:49:19 +00:00
Greg Beaver
0503140256 add little fix to phar_mount_entry to ensure path separators are unix-based on windows 2008-02-25 04:30:55 +00:00
Greg Beaver
ec7f89fe79 implement Phar::mount() for directories, add test
# opendir not yet implemented for mounted directories
2008-02-25 04:23:36 +00:00
Greg Beaver
b5c765f942 fix tests 2008-02-24 23:48:19 +00:00
Greg Beaver
d108a03553 fix --CLEAN-- 2008-02-24 23:47:13 +00:00
Greg Beaver
1ea58d0c04 fix test 2008-02-24 23:44:12 +00:00
Greg Beaver
a5a246e876 add missing declaration of phar_rename_archive 2008-02-24 23:40:14 +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
Steph Fox
89842172e3 Updating tests. 100% pass rate here now - not sure about the rest of the world just yet (sorry Marcus). 2008-02-24 19:34:05 +00:00
Greg Beaver
a8d0c64662 fix faulty & in check for creation of phar manifest 2008-02-23 21:33:46 +00:00
Greg Beaver
588f0660e9 free mounted_dirs on error to avoid memleak 2008-02-23 21:29:57 +00:00
Greg Beaver
f6862d4a33 fix unfreed value found in tempmanifest1.phpt 2008-02-23 19:44:51 +00:00
Greg Beaver
b3a266fca8 fix double error (this fixes frontcontroller22.phpt) 2008-02-23 19:26:18 +00:00
Greg Beaver
dc43219add down to 1 failing zip test with this commit 2008-02-23 18:28:36 +00:00
Greg Beaver
94f39ee501 fix unfreed value 2008-02-23 18:26:20 +00:00
Greg Beaver
a0e5e40663 port same fix from tar.c to zip.c 2008-02-23 18:24:41 +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
0c647b5c1c fix test, missing phar.readonly=0 --INI-- section 2008-02-23 18:08:54 +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
Greg Beaver
0e6457b2cf free spprintf'ed stub after using it 2008-02-23 14:59:52 +00:00
Greg Beaver
0996c1ffb5 fix test - needed phar.readonly=0 INI section 2008-02-23 14:57:59 +00:00
Marcus Boerger
2f29db8333 - Fix logic 2008-02-23 13:04:59 +00:00
Steph Fox
b2dbfbc321 As the line below says - there shouldn't be an exception here. 2008-02-21 18:51:54 +00:00
Steph Fox
20836262c8 Updated wrong expectation (different stub). 2008-02-21 18:44:06 +00:00
Steph Fox
9a1e7ee88b Update tests to accommodate those two extra bytes 2008-02-21 15:20:46 +00:00
Steph Fox
cf9bbcc2e6 Satisfy the pedants :) 2008-02-21 14:48:41 +00:00
Steph Fox
e8e85afbcc Updating conversion tests to check for more conversion parameters than one. Note that these will all fail against current CVS.
@Greg: We need to clarify conversion policy across the board.
2008-02-21 14:45:44 +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
Steph Fox
15158bf49d Fix filenames 2008-02-20 19:26:40 +00:00
Steph Fox
d8bebd7259 Implement $phar->setDefaultStub()
Note that Phar::createDefaultStub() still exists at this point
2008-02-20 19:22:12 +00:00
Steph Fox
9752739cf2 Let's have reflection reflect reality... 2008-02-20 17:58:56 +00:00
Steph Fox
3285ceba7e Take some of the pain out of stub rewrites. (Full default stub is tested elsewhere.) 2008-02-20 14:28:49 +00:00
Steph Fox
8febc7fd54 Fix 'clean' sections 2008-02-20 13:33:00 +00:00
Steph Fox
6306029051 Move supporting files to their own directory (toplevel tests) 2008-02-20 13:11:40 +00:00
Steph Fox
89217ae543 Fix clean section 2008-02-19 03:24:18 +00:00
Steph Fox
76b02cca40 Update tests to match new stub length 2008-02-19 03:12:11 +00:00
Steph Fox
7bb00d024e Allow createDefaultStub() to accept 0, 1 or 2 parameters. Default for both CLI and web is 'index.php'.
@Greg: this breaks a handful of tests due to the change in stub.h - will fix in a bit. The only one that's interesting is you can't do strlen(Phar::createDefaultStub()) and expect anything other than an exception now.
2008-02-18 21:45:02 +00:00
Steph Fox
335e57e443 Fix ZTS build (again), kill unused var 2008-02-18 04:51:04 +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
6798dc44ed add Phar::mount() to manually mount a file or directory
# TODO: implement directory mounting.  Involves scanning paths that are not exact matches for a partial match.
# this also means maintaining a per-phar hash of mounted directories for quick matching
2008-02-18 04:32:50 +00:00
Greg Beaver
9c62ef1124 add externally parsed files to temporary manifest (this will be made
optional and must be explicitly enabled per-phar)
2008-02-18 03:37:51 +00:00
Steph Fox
6acac494ab Fix ZTS build 2008-02-18 00:46:07 +00:00
Greg Beaver
54ff8c3a8f begin work on ability to mount files from external locations as if they were inside of a phar archive 2008-02-15 05:01:40 +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
Steph Fox
2a5f1ba3a6 Add missing SKIPIF, rename vars for readability 2008-02-12 16:55:50 +00:00
Steph Fox
2ad96985c7 - it helps if you add the new files :) 2008-02-12 16:42:35 +00:00
Steph Fox
85e641ebb4 Make tests/tar in line with tests/zip. 2008-02-12 16:39:59 +00:00
Greg Beaver
592635d0c0 fix TSRM build 2008-02-12 05:38:01 +00:00
Greg Beaver
97484e0b95 update TODO to reflect must-haves prior to 2.0 2008-02-12 05:36:02 +00:00
Greg Beaver
22d05677c1 fix test (all tests pass on unix now) 2008-02-12 05:30:59 +00:00
Greg Beaver
3234e78ca1 fix remaining broken tests broken by the addition of phar->fp closing 2008-02-12 05:28:06 +00:00
Greg Beaver
2f1ec934af fix some of the failing tests due to non-reopened phar fp 2008-02-12 05:16:53 +00:00
Steph Fox
b1ed2e8059 There's a difference between 'BORKED' and 'FAILED'... 2008-02-11 21:05:47 +00:00
Steph Fox
ef46f3e3a2 Funnily enough those frontcontroller tests still pass here! Investigating... 2008-02-11 20:55:44 +00:00
Steph Fox
914c94d497 kill a couple of msvc warnings 2008-02-11 20:53:05 +00:00
Greg Beaver
ba002c5b9c revert last commit to phar_object.c
fix open file pointers issue on windows
2008-02-11 17:13:18 +00:00
Greg Beaver
4c68617106 add destructor for Phar object to decrease refcount 2008-02-11 16:49:53 +00:00
Greg Beaver
d659ce7a0c fix windows pathname issues 2008-02-11 07:33:20 +00:00
Greg Beaver
8cd58822c3 fix TSRM and 5.2 build 2008-02-11 06:58:56 +00:00
Greg Beaver
ca7ae5d190 update TODO 2008-02-11 06:54:46 +00:00
Greg Beaver
d388ec586f move creation of phar archive to the point at which it is committed to disk, instead of
at the moment it is attempted access. (making some real progress now, all tests pass on unix)
2008-02-11 06:53:56 +00:00
Greg Beaver
de5238a3bc minor refactoring to remove 1 call to zend_get_executed_filename() 2008-02-11 06:49:22 +00:00
Greg Beaver
1a6fb65c83 new test for special tar-based app and more iteration test 2008-02-11 06:47:26 +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
3ade59e537 update test phars 2008-02-11 01:07:53 +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
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
15410a4f66 make maximum manifest size 100MB for phar archives, simple apps are hitting the 1 MB limit quite easily. 2008-02-08 05:56:26 +00:00
Greg Beaver
5b5c86df9f better fix for double free - ensure that SEPARATE_ZVAL() inside
zlib_filter.c actually separates the zval, then we can zval_dtor() it
properly
2008-02-08 05:41:59 +00:00
Greg Beaver
4e42110f3e remove test accidentally added 2008-02-08 05:08:18 +00:00
Greg Beaver
fa7a1779a1 remove unnecessary INIT_ZVAL(filterparams) that causes unfreed value 2008-02-08 05:05:13 +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
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
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
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
Antony Dovgal
a04bcdfcec remove old code leftover causing problems 2008-02-07 08:45:43 +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
9af8b12b2b move to in between BEGIN_EXTERN_C() block, to avoid breakage with C++ (i.e. windows)
# david, can you check on mac to be sure this doesn't break?
2008-02-01 22:23:37 +00:00
David Coallier
d4d8f3d412 - OSX "extern" compatibility fix. 2008-02-01 22:13:14 +00:00
Greg Beaver
47320359e9 remove unused variable, eliminate an invalid read reported by valgrind 2008-02-01 19:50:06 +00:00
Steph Fox
b5e8315e80 ws 2008-02-01 14:40:57 +00:00
Steph Fox
3e6d9e72d4 Generate newline at end of stub.h 2008-02-01 14:38:45 +00:00
Antony Dovgal
e493059f55 check for empty/null path
still some leaks are left
2008-02-01 11:36:45 +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
Antony Dovgal
97c3dbaf56 this string should be freed later since path == free_path 2008-02-01 11:25:11 +00:00
Antony Dovgal
f6238ee664 fix compile warning (No newline at end of file) 2008-02-01 11:09:34 +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
Steph Fox
ed2785e2a5 OK so let's kill the bug-hider 2008-01-30 00:53:56 +00:00
Steph Fox
76640a615f - One last tweak (so Phar and no-phar work the same again now)
- Bunch of test fixes
- Note: I added a silencer to the unlink() call in zip/tarmaker to avoid system warnings here. If this messes up tests elsewhere we'll need to re-think.
2008-01-29 11:58:27 +00:00
Steph Fox
182519877b Job done. 2008-01-29 09:45:11 +00:00
Steph Fox
7e85b150a6 Rock'n'roll... just php includes to figure out now. 2008-01-29 07:10:22 +00:00
Steph Fox
a6abbfd55d 'It works on my box'.
Please test.
2008-01-28 21:23:02 +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
618a29411d Get rid of zip requirement in the last few tests
@Greg: zip/tarmaker.inc needs a rewrite
2008-01-28 16:49:28 +00:00
Steph Fox
975a1b87af Get rid of zip requirement 2008-01-28 16:31:56 +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
6f95353e77 - Added is_writable() check on temp directory
- Regenerated stub and tests/nophar.phar
- Fixed tests
2008-01-26 00:12:00 +00:00
Steph Fox
ddc051cebe - Rewrite stub to take up slightly less space
- Fix tests
- Test phars should probably be regenerated, although only one fails here currently (nophar.phar in web context)
2008-01-25 17:26:18 +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
29c5c804d0 initial work on more efficient zip implementation, read support working, write not implemented yet
This implementation will support read/write of extra field headers, both zlib/bzip2 compression read/write
it will also delay header comparison/crc32 check until file open, making opening a single file
within the zip much more efficient for large zip files
it also uses emalloc/php streams and is therefore less likely to leak.
this code is not yet built in config.m4/config.w32
2008-01-23 23:19:03 +00:00
Greg Beaver
47a60c4f16 fix 2 tests, add phar.readonly checks to rmdir/mkdir 2008-01-22 20:24:52 +00:00
Greg Beaver
f51bf6118c fix tests to match CVS 2008-01-22 05:26:38 +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
34c1e6e112 s/1.3.0/2.0.0/ 2008-01-19 20:13:31 +00:00
Greg Beaver
d5fd042872 bump 1.3.0 to 2.0.0, this is a big feature addition release 2008-01-19 19:51:14 +00:00
Greg Beaver
d7ff13cf9a update package.xml 2008-01-19 18:39:49 +00:00
Greg Beaver
a5358c0725 bump API version if the created phar has directories in it, so that it won't load with older phar versions 2008-01-19 18:30:30 +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
Nuno Lopes
dc84b8b767 fix gcov build 2008-01-18 20:12:45 +00:00
Greg Beaver
7540adf058 major improvement:
the new default stub allows creation of phars that run identically
1) with Phar extension
2) without Phar extension
3) extracted to disk from the phar
this makes the default phar format quite interesting as it eliminates the only drawback of the extension
2008-01-18 05:42:16 +00:00
Greg Beaver
109cbc9f50 add needed define back into config.w32, make zip required mod on win32, remove lib/.cvsignore 2008-01-18 00:11:37 +00:00
Greg Beaver
ad23787e0c remove unneeded define, zip is required on windows 2008-01-17 20:21:55 +00:00
Greg Beaver
5689f3c9c6 add new test for opening a zip-based phar with no zip ext, update skipif for phar_convert test 2008-01-17 20:17:40 +00:00
Greg Beaver
e4c02a6b96 do fancy-shmancy zip dependency validation because ZEND_MOD_OPTIONAL_EX doesn't do any version validation 2008-01-17 05:52:18 +00:00
Greg Beaver
86fc96d86b update package.xml 2008-01-17 04:56:40 +00:00