Commit Graph

266 Commits

Author SHA1 Message Date
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
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
7e65f56264 MAPPHAR_ALLOC_FILE slipped in there somehow 2008-01-10 22:05:30 +00:00
Greg Beaver
74df58d255 fix tsrm build, fix various problems with initialization and zlib/bz2-compressed phars 2008-01-10 21:21:38 +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
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
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
4bce48417b split stream file handlers into stream.c and directory handlers into dirstream.c 2008-01-08 20:31:54 +00:00
Greg Beaver
63adb98f78 split out zip functions 2008-01-08 19:40:23 +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
3dca799fbb fix extension detection for aliases with no extension 2008-01-07 17:18:41 +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
826e98be83 eliminated memleak, now to make it recognize "dir" as a directory 2008-01-06 05:28:27 +00:00
Greg Beaver
99922cb729 fix typo in phar.c if bz2 is disabled 2008-01-06 05:16:20 +00:00
Greg Beaver
632a633154 fix segfault, add separate tar test for readonly=0 on corrupted tar 2008-01-05 23:02:23 +00:00
Greg Beaver
2fa568b7b0 do not attempt to create a new phar if a file exists and is corrupted or is not a phar archive,
i.e. require a clean slate - a non-existent file or a valid phar archive - to muck around with phar contents
add the first tar-based phar test
2008-01-05 22:46:54 +00:00
Greg Beaver
653dc9e8ce fix front controller tests (requires patch to run-tests.php posted to internals a little while ago)
allow phars to have extension .php as last resort
fix phar-based phars for MIME_OTHER type
2008-01-05 03:41:43 +00:00
Greg Beaver
67688371f7 use zip_free() instead of zip_close(), and don't add a stub if it already exists in phar_zip_flush(), update TODO 2008-01-04 17:04:41 +00:00
Marcus Boerger
95a9f1faf6 - Fix module info for bz2
- Differentiate enabled, disabled and unavailable
2008-01-04 16:10:49 +00:00
Greg Beaver
e8a5b20514 replace crappy $_SERVER munging with explicit munging via
Phar::mungServer().  This static method takes an array with one of these 4 indices (case-sensitive):
'PHP_SELF', 'SCRIPT_NAME', 'SCRIPT_FILENAME', 'REQUEST_URI'
and removes any reference to the actual path on the server.  This allows older apps to function unmodified inside a phar.
the variables are re-registered as PHAR_PHP_SELF and company to allow access from clever script files
[DOC]
2008-01-04 04:57:11 +00:00
Greg Beaver
8e18f1cae1 Phar::webPhar() and various problems relating to shutdown in an apache process fixed 2008-01-04 01:45:37 +00:00
Greg Beaver
f589855093 fix tar-based phars creation and loading 2008-01-03 18:13:27 +00:00
Greg Beaver
8ee4266b3f initial tar support - a few kinks to work on in phar creation, but read works 2008-01-03 04:45:00 +00:00
Greg Beaver
652d39c330 add zip-based phar support. not quite working is webPhar(), not sure why yet 2007-12-31 22:42:40 +00:00
Greg Beaver
e861913e39 fix windows build
# there HAS to be a better way to do this...
2007-12-24 21:40:54 +00:00
Greg Beaver
5200481aaf fix mem leak 2007-12-24 20:30:44 +00:00
Greg Beaver
02c7ff1343 complete re-factoring of front controller. Now it is done with
Phar->webPhar():
<?php
Phar::webPhar();
__HALT_COMPILER();

With the above stub, the default front controller will kick in.  An array of mime type overrides, and another
array mapping phar file entry -> redirected entry can be used to further customize
[DOC]
2007-12-23 21:12:42 +00:00
Greg Beaver
8e4cc4b3dd first attempt at major new feature: default front controller for web
Currently, an entire phar entry is leaked for no obvious reason, otherwise it works.  Sample code:
The phar has to be created using Phar->useFrontController(); and the stub performs actual resolution of which file to load:
<?php
Phar::mapPhar();
include 'phar://' . __FILE__ . '/' . substr($_SERVER['REQUEST_URI'], strlen(basename(__FILE__)));
__HALT_COMPILER();
?>

Phar automatically determines mime type from the file extension and either parses or displays the file.  Modification of REQUEST_URI
and other variables should happen in the stub
[DOC]
2007-12-22 07:46:53 +00:00
Greg Beaver
185a4a8309 on second thought, hooking into getcwd() is a bad idea, who uses this for code loading, anyways? 2007-12-21 04:49:25 +00:00
Greg Beaver
0d830a27ea implement cleaning of crap paths - major functionality boost 2007-12-20 23:12:40 +00:00
Greg Beaver
0bfc046eac remove minor (and unnecessary I might add) windows compile warnings 2007-12-20 04:12:23 +00:00
Greg Beaver
d4eccb4471 holy cow - include/fopen/cwd magic fully working on unix now for windows testing 2007-12-19 04:37:25 +00:00
Greg Beaver
2222da9493 making progress (include magic works) 2007-12-19 03:17:05 +00:00
Greg Beaver
0c51d58138 [unfinished] magically handle getcwd() and fopen() with include_path inside phar
this work is incomplete, but compiles and existing tests pass
2007-12-18 17:01:24 +00:00
Greg Beaver
47cef85c22 fix alias overloading detection on windows 2007-12-14 18:42:57 +00:00
Greg Beaver
4fb3122b16 fix terrible logic discovered in windows testing (not sure how it ever worked on unix) 2007-12-14 18:34:12 +00:00
Greg Beaver
708569029c windows fixes #2 (thanks Steph you rule) 2007-12-14 05:45:48 +00:00
Greg Beaver
c6fe26af37 windows fixes (thanks Steph you rule) 2007-12-14 05:39:20 +00:00
Greg Beaver
38bf150e4d remove stupid*$(# debug code 2007-12-14 05:00:59 +00:00
Greg Beaver
8a614e30db use thread-safe global var to store zend_compile_file, and restore the current zend_compile_file, not the one we
found in MINIT
2007-12-11 19:28:35 +00:00
Greg Beaver
47d859ced2 use stream_copy_to_stream again, figured out how to make the stupid filters work 2007-12-11 19:21:01 +00:00
Greg Beaver
688aef57f8 add the ability to automatically resolve includes inside a phar to files within that phar, so
no code modification is needed to include/require
2007-12-09 21:57:44 +00:00
Greg Beaver
4bcb68a4e8 fix errors found in delMetaData(), add get/delMetaData() to MetaData read test 2007-11-25 05:04:40 +00:00
Greg Beaver
e34be4f8bc preliminary work on using gnupg to verify/create signatures - no implementation, just phpinfo() output and build rules 2007-11-24 04:30:08 +00:00
Greg Beaver
a72251be6e experimental support for optional bz2 extension - should make windows users a whole lot happier 2007-11-24 04:06:44 +00:00