Commit Graph

534 Commits

Author SHA1 Message Date
Greg Beaver
fffdf661c9 fix bug #45907: undefined reference to PHP_SHA512Init 2008-10-09 00:50:47 +00:00
Greg Beaver
8db86ad19e MFB: fix minor issues found by ICC (unused variables and the like) 2008-09-13 22:31:18 +00:00
Greg Beaver
9eb83b6ae9 fix minor issues found by ICC (unused variables and the like) 2008-09-13 22:30:55 +00:00
Greg Beaver
6391270b85 MFPHP5: fix Bug #46032: PharData::__construct wrong memory read 2008-09-11 03:29:42 +00:00
Greg Beaver
e7b6fe1b45 fix Bug #46032: PharData::__construct wrong memory read 2008-09-11 03:29:15 +00:00
Steph Fox
318d5f98ff - unnecessary ;
We are now 100% synched - let's keep it that way!
2008-08-31 21:02:55 +00:00
Steph Fox
cd011d1e9a - MFB 2008-08-31 20:54:28 +00:00
Greg Beaver
b2efb50cfd remove unnecessary ; 2008-08-31 19:38:40 +00:00
Greg Beaver
513cec31d3 fix compile warning in PHP < 6.0 2008-08-31 06:58:04 +00:00
Greg Beaver
e30bf5af3b remove superfluous return statements, merge from pecl/phar 2008-08-31 06:42:46 +00:00
Greg Beaver
1c66670ee8 merge minor optimization removing strlen from pecl/phar 2008-08-31 06:38:09 +00:00
Greg Beaver
6dcdb77f7b remove unused variables, merge from pecl/phar 2008-08-31 06:31:53 +00:00
Greg Beaver
27cf27568d use %u instead of %d, merge from pecl/phar 2008-08-31 06:26:19 +00:00
Steph Fox
4e5280a7a2 - ws/cs, macros, code that only affects other branches
- some unsynced changes need valgrind testing before they can go into this branch, see PECL/HEAD
2008-08-01 13:48:45 +00:00
Steph Fox
c6aa379d74 - This is as good as it gets in HEAD at present (~30% tests fail here) 2008-08-01 13:45:06 +00:00
Antony Dovgal
b53da9cd80 fix folding 2008-07-29 10:52:08 +00:00
Steph Fox
6895773aff - Utilize new UNIX_PATHS flag in SPL
- Fix tests

@Jani: hold back on the bunny-killing, HEAD will be in sync later today
2008-07-24 09:22:35 +00:00
Dmitry Stogov
c48c63f5e6 Improved webPhar speed (frontcontroller11.phar.phpt is disabled, should be removed) 2008-07-22 07:03:00 +00:00
Dmitry Stogov
44557cf981 Improved support for opcode caches. Now some open() syscalls might be eliminated by caches. 2008-07-16 15:09:39 +00:00
Dmitry Stogov
1cfd92fc43 Fixed efree(NULL) 2008-07-09 08:47:05 +00:00
Steph Fox
2c9df0990d - We forgot to check that the phar exists before trying to extract files from it :) 2008-07-07 01:11:07 +00:00
Greg Beaver
8bf72978b3 fix several issues:
1) segfault in phar_buildfromdirectoryiterator8.phpt
2) tests failing because SKIPDOTS is default on 64 bit, not on 32
3) Marcus, you really need to add SKIPDOTS as a class constant, so we don't have to use 0x00001000
2008-06-24 01:11:27 +00:00
Greg Beaver
10f6d9a556 true fix for potential segfault in phar_build 2008-06-23 04:00:23 +00:00
Steph Fox
c68a82ac7d - Revert the two blocks of code that implement the phar_build optimization, causes segfaults under *nix
- Leave the new structure in place to make re-implementation trivial
2008-06-22 16:35:26 +00:00
Steph Fox
332a185e08 - ws, typo fix 2008-06-22 13:10:03 +00:00
Steph Fox
b964ec6e5d - ws 2008-06-21 18:57:53 +00:00
Greg Beaver
baee4e6028 close stream on failure 2008-06-21 06:55:56 +00:00
Greg Beaver
529aa19cc7 82x(./profile2) speedup for buildFrom*() 2008-06-21 06:53:10 +00:00
Johannes Schlüter
62726c967c - Fix ZTS build (not required on HEAD, patch by Uwe Pries) 2008-06-20 09:17:53 +00:00
Greg Beaver
7cc6b9f3f5 making progress - up to 42/phar vs. 48/disk with these optimizations 2008-06-20 05:42:58 +00:00
Greg Beaver
cbe23b9f20 fix windows build and more performance jumps (these are minor)
implement real copy-on-write
use virtual_dirs for wrapper stat
2008-06-18 06:38:47 +00:00
Greg Beaver
4104786072 another optimization - move inode hash to initial manifest parsing, improves runtime perf of stat slightly 2008-06-15 21:42:20 +00:00
Greg Beaver
d8ed660a02 minor optimization 2008-06-15 21:15:29 +00:00
Greg Beaver
04e257a8e1 HUGE speed improvement, from 19 req/sec to 27 req/sec for phpMyAdmin - now speed with apc+phar.cache_list = on-disk speedcvs diff -u |less This is by generating a list of virtual directories and using those in stat calls instead of scanning the whole manifest hash table. on-disk phpMyAdmin = 28 req/sec 2008-06-15 18:15:48 +00:00
Greg Beaver
4f9daeed11 [DOC] implement full signature support for tar-based archives. By default, data archives do
not have a signature, but can have one set via setSignatureAlgorithm()
2008-06-13 22:07:44 +00:00
Greg Beaver
5ff4deaa53 full refactor of signatures complete - now to implement them for tar as a starting point 2008-06-13 20:15:19 +00:00
Greg Beaver
8b8a64a3e8 fix PHP Bug #45218: PHAR archive built from directory limited by max open file handles 2008-06-10 19:20:33 +00:00
Marcus Boerger
159561e9da - Need to use a proper inheritance check 2008-06-02 15:49:03 +00:00
Marcus Boerger
aaf6b216ed - Fix docu 2008-06-01 17:14:48 +00:00
Greg Beaver
5fbeb235d2 add openssl signing support. This adds an extra parameter
for the contents of the exported private key to Phar->setSignatureAlgorithm, and expects the public key to be in
a file named blah.phar.pubkey in the same directory as the phar blah.phar.  This works with openssl static or
shared and fails gracefully if openssl is not present without adding a dependency. config.w32 needs updating to match config.m4 [DOC]
2008-06-01 04:21:26 +00:00
Greg Beaver
ca6d36efb8 MFB: refactor function names for clarity. No functionality change 2008-05-30 22:39:33 +00:00
Greg Beaver
8b600a72dc refactor function names for clarity. No functionality change 2008-05-30 22:38:46 +00:00
Steph Fox
76a9ec377b - MFB major fixes
* found felipe's segfault in util.c and fixed the segfault (3 tests fail due to odd behavior of . and .. on this machine)
   * fixed serious flaws in the setting/resetting of is_data - now it works properly.  Assume
     all new PharData are tar-based, and allow passing Phar::ZIP to PharData constructor to override this
   * fix broken earlier commit, introduced segfault that broke 20 tests here
2008-05-24 14:18:31 +00:00
Steph Fox
bdca5a12b0 - MFB fix offset detection in tar files 2008-05-24 13:59:56 +00:00
Steph Fox
51967b91d5 "We shouldn't need a full path to the mount"
- Fixed under Windows, cleaned up test
2008-05-24 13:13:47 +00:00
Greg Beaver
4b035dae5f major fixes
* found felipe's segfault in util.c and fixed the segfault (3 tests fail due to odd behavior of . and .. on this machine)
 * fixed serious flaws in the setting/resetting of is_data - now it works properly.  Assume
   all new PharData are tar-based, and allow passing Phar::ZIP to PharData constructor to override this
 * fix broken earlier commit, introduced segfault that broke 20 tests here
2008-05-22 06:33:09 +00:00
Felipe Pena
e1bfc452d3 - Fix build (ZTS) 2008-05-21 22:52:30 +00:00
Greg Beaver
1f661c81c4 fix offset detection in tar files 2008-05-21 22:00:43 +00:00
Greg Beaver
8589859191 MFB fix convertTo\*() for same-named archives with no files 2008-05-21 20:39:33 +00:00
Greg Beaver
79ae1c7273 fix convertTo\*() for same-named archives with no files 2008-05-21 20:24:40 +00:00
Greg Beaver
a08acfb080 s/zend_hash_exists/zend_hash_find/ 2008-05-20 05:01:08 +00:00
Greg Beaver
ccf430ca93 MFB relax rename requirements 2008-05-20 04:09:41 +00:00
Greg Beaver
07d6758c86 relax conversion, so that if a phar has no files, we can convert it to another format without changing the extension 2008-05-20 03:56:35 +00:00
Steph Fox
f08aea109b - IS_UNICODE checks and conversions
- stub and creation file updates
- far too many test updates to think about
2008-05-19 19:05:42 +00:00
Greg Beaver
eb99aa475e MFH fix mem leak, add test for previous segfault fix 2008-05-18 23:41:17 +00:00
Greg Beaver
0800b3b159 fix memleak, add test for previous segfault fix 2008-05-18 23:41:08 +00:00
Greg Beaver
3d953abaf3 MFB fix segfault 2008-05-18 23:12:47 +00:00
Greg Beaver
b149e8c0fa fix segfault, test coming shortly 2008-05-18 23:11:24 +00:00
Greg Beaver
11fb7561f0 enable by default statically instead of shared
this is done by removing zlib/bz2 explicit dependencies because they are unnecessary
we only ever use the stream filter, and the check for existence has
been moved to runtime where it is after startup
2008-05-17 20:07:38 +00:00
Greg Beaver
4aa4f1fabb enable by default statically instead of shared
this is done by removing zlib/bz2 explicit dependencies because they are unnecessary
we only ever use the stream filter, and the check for existence has
been moved to runtime where it is after startup
2008-05-17 20:07:22 +00:00
Greg Beaver
25b8e6cc3f MFB: add full metadata support for tar-based archives and test 2008-05-15 23:46:54 +00:00
Greg Beaver
719beb79d4 add full metadata support for tar-based archives and test 2008-05-15 23:46:29 +00:00
Greg Beaver
144e472967 MFB: plug security hole of unfettered creation access to .phar magic directory 2008-05-15 16:09:21 +00:00
Greg Beaver
de5aaaa74c fix potentially major security hole: modification/creation of files in .phar directory enabled in many locations
which then allows easy creation of tar/zip-based phar archives with a simple rename even when phar.readonly=1.  Plug the hole very tightly, allowing read access to
files, and also excluding them from opendir() output
2008-05-15 16:09:01 +00:00
Steph Fox
6a0682d986 - MFH
- Make internal code forward-compatible. This included a binary cast in the default stub, hence test updates.
2008-05-14 21:29:51 +00:00
Steph Fox
c1ae13b985 - Make internal code back-compatible. This included a binary cast in the default stub, hence many test updates.
- Just over a third of tests pass. Test manifests are broken currently.
2008-05-14 21:27:31 +00:00
Steph Fox
247d91e780 - 'It builds on my box'.
- Don't expect any tests to pass.
2008-05-13 18:35:25 +00:00
SVN Migration
16b4d8e0e1 This commit was manufactured by cvs2svn to create branch 'PHP_5_3'. 2008-05-12 21:03:49 +00:00
Greg Beaver
82dc03941a fix weird alias issues, add tests to check for new-found problems 2008-05-12 20:42:07 +00:00
Greg Beaver
ad1be25d8c don't copy contents of linked/mounted files when converting an archive, and be sure to dupe mounted value 2008-05-11 22:45:03 +00:00
Greg Beaver
7149523766 add safety check to prevent unlinkArchive() from being called by a file within the archive 2008-05-11 21:15:47 +00:00
Greg Beaver
38d5943ee6 increase code coverage of funcinterceptors to 90%+, fix many bugs, fix errant wrong test condition in fgc_edgecases 2008-05-11 19:17:51 +00:00
Greg Beaver
53e02373d0 fix handling of mounted entries when flushing in all phars, and of deleted entries with open references in tar-based phars, do not extract mounted entries, add to test 2008-05-08 02:58:45 +00:00
Greg Beaver
f134a909c3 optimize phar filename extension detection to first search through known phars. This eliminates several stat/realpath calls for archives with lots of files 2008-05-07 17:24:22 +00:00
Greg Beaver
eda25ddb34 validate user-supplied aliases when converting archives to other formats 2008-05-07 06:36:24 +00:00
Greg Beaver
549bf83bd1 [DOC]
remove phar.extract_list
remove Phar::getExtractList()
2008-05-07 05:38:31 +00:00
Greg Beaver
196f0ef42b fix segfault in buildfromdirectory2 test and potential segfault 2008-05-06 21:23:48 +00:00
Greg Beaver
5ba8ca70a4 fix alias overloading handling for archives that are not in use 2008-05-06 21:14:53 +00:00
Steph Fox
c322c1a94a - Kill Windows warning when int meets short
- All tests still pass
2008-05-03 21:09:56 +00:00
Greg Beaver
a180fcc9bc add Phar::unlinkArchive() to allow complete removal of a parsed phar archive from memory and disk 2008-05-03 02:04:24 +00:00
Greg Beaver
bfbe53eeb2 refactor isTar/isZip/isPhar into isFileFormat(int format) where format is one of Phar::TAR,, Phar::ZIP, Phar::PHAR
[DOC]
2008-05-02 05:05:56 +00:00
Greg Beaver
e0bc2b2be1 update TODO, re-order methods to be alphabetical, tweak extractTo to set permissions and handle NULL for files
# this also matches the docs I just committed :)
2008-05-02 04:44:39 +00:00
Greg Beaver
0a3fc4faba fix unix-only valgrind issue by initializing arch 2008-04-30 23:44:30 +00:00
Greg Beaver
483018e170 remove unneeded exception handling (webPhar is always within an outer zend_execute block which handles exceptions for us, this is unnecessary) 2008-04-30 02:20:48 +00:00
Steph Fox
8559a2dbde - Prevent phars with empty manifests flushing to disk
- This would've fixed that test... removing clean section

@Greg: I commented out the call that breaks the Windows build, pending a decision about its future.
2008-04-29 12:06:54 +00:00
Greg Beaver
984ea1f437 fix segfault (now all tests pass here) 2008-04-28 23:00:46 +00:00
Greg Beaver
7220c19556 fix tar generation - we were subtly corrupting the header with \0 because of use of strcpy 2008-04-28 16:44:53 +00:00
Greg Beaver
5da6c48f7d add open_basedir/safe_mode checks for files in Phar::addFile() 2008-04-27 23:59:41 +00:00
Steph Fox
bcd2ddd018 - Kill another one from the gcov site's parameter parsing report 2008-04-27 16:42:03 +00:00
Steph Fox
2ea698eae7 - Make it possible to extract all *and* overwrite 2008-04-27 11:26:15 +00:00
Steph Fox
77dcb8cffd - Kill a few uninitialized vars (thanks gcov) 2008-04-27 10:14:00 +00:00
Greg Beaver
79a45a9666 fix buildfromiterator base to exclude directory separator on unix or windows, fix 10 test to have new tests 2008-04-26 17:09:58 +00:00
Steph Fox
cf7f50e42c - Added a RecursiveIterator/buildFromIterator test
- Fixed up bug13727.phpt to take < 15 minutes :\\ and clean up after itself
- Cleaned up protos/reflection data
- Added myself to package.xml credits
2008-04-26 13:22:38 +00:00
Greg Beaver
0c2f3b760a add Phar::extractTo(dest_directory[, mixed files[, bool overwrite]])
this is very similar to ext/zip's extractTo and is based on that code, with the addition of the third parameter, which
is used to allow overwriting existing files (disallowed by default, unlike ext/zip's implementation)
[DOC]
2008-04-26 05:31:00 +00:00
Steph Fox
dbb4618bd5 - cs 2008-04-26 02:04:09 +00:00
Steph Fox
f040cb6492 - fixed those pesky memleaks 2008-04-26 01:52:22 +00:00
Steph Fox
9bf8d7429e - implemented Phar::buildFromDirectory
@Greg: There are two (identical) recurring memleaks I can't seem to kill, both marked FIXME. Would you please take a look?

[DOC] $phar->buildFromDirectory(dirname[, regex]). Return value is an array pairing each file in the archive index with the original path on the filesystem.
2008-04-25 21:37:41 +00:00
Greg Beaver
8657ab7e5a add test for bug #13727, fix bug #13727 2008-04-25 16:50:22 +00:00
Greg Beaver
84004bf248 new test with code coverage for PharFileInfo::setMetadata/delMetadata, improve error messages 2008-04-25 16:05:05 +00:00
Greg Beaver
13dc477de2 new code coverage test, improve clarity of error message when chmod is used on a temp directory 2008-04-25 15:53:02 +00:00
Greg Beaver
efe519c194 fix access fault on windows, fix memleak on all platforms when accessing a temp directory via offsetGet 2008-04-25 04:34:03 +00:00
Greg Beaver
0db641af3e rework PharFileInfo->decompress and add failing test 2008-04-24 19:57:22 +00:00
Greg Beaver
91e67a4fbd test PharFileInfo::__construct, fix potential segfault, and bad logic in phar detection 2008-04-24 05:18:50 +00:00
Greg Beaver
8f0c9caac5 remove redundant unreachable code in Phar::copy, augment test, and add failing condition that needs to be fixed 2008-04-24 04:14:05 +00:00
Greg Beaver
696dafa370 new test for Phar::decompress() 2008-04-24 04:05:20 +00:00
Greg Beaver
3190bd0884 increase code coverage, fix minor memleak 2008-04-23 18:54:09 +00:00
Greg Beaver
ab1d8adb96 fix default format conversion, increase code coverage 2008-04-23 18:44:43 +00:00
Greg Beaver
3b8fc7309f new test increases code coverage, fix memleak found by test 2008-04-23 18:30:53 +00:00
Greg Beaver
c034683550 new test for Phar::isValidPharFilename. Fix Phar::isValidPharFilename. Fix extension detection for all cases 2008-04-23 18:11:20 +00:00
Greg Beaver
19088c1930 remove/move unreachable code 2008-04-23 17:23:32 +00:00
Greg Beaver
1dc190e680 improve rewrite callback support, add test for callback that does not return string/false 2008-04-23 17:18:28 +00:00
Greg Beaver
ce5732112e new test for invalid rewrite callback 2008-04-23 16:47:12 +00:00
Greg Beaver
76b8f30659 new test for webPhar with phar.extract_list 2008-04-23 16:00:06 +00:00
Greg Beaver
5224d341b6 ensure freeing of cwd/name happens in all cases 2008-04-22 17:34:00 +00:00
Greg Beaver
0338b28939 re-enable disabled cwd code 2008-04-22 17:19:06 +00:00
Greg Beaver
d8b4c2795e remove unreachable code, add test for large non-php file 2008-04-22 17:17:29 +00:00
Greg Beaver
379bcf1f14 remove unreachable code 2008-04-22 17:13:07 +00:00
Greg Beaver
cb8f158cd5 fix PATH_INFO munging, add to test case 2008-04-22 17:11:30 +00:00
Greg Beaver
5ac9c1f23e remove unreachable code, add test for no file extension and unknown file extension with Phar::webPhar 2008-04-22 17:03:10 +00:00
Greg Beaver
4388a65aa8 fix Phar::mount() to also allow running externally with full phar:// path, add test 2008-04-21 18:21:54 +00:00
Greg Beaver
e0873a380d fix Phar::running() 2008-04-21 18:06:20 +00:00
Greg Beaver
25cdc7de2b fix discovery of files hidden in a URL - makes using any regular front controller possible 2008-04-21 17:59:28 +00:00
Greg Beaver
2f56c7f343 new test for custom 404 handler, fix segfault found by test 2008-04-21 17:46:24 +00:00
Greg Beaver
779fec2278 implement opendir for mounted directories - much simpler to do than I initially thought 2008-04-21 16:29:09 +00:00
Greg Beaver
3d858f4aa9 implement symbolic link support within a tar-based phar archive
this also resulted in a major fix for mounted directories, which were recycling the 'link' field which
could cause stupid conflicts with actual links, so move that to new 'tmp' field.
2008-04-21 06:17:51 +00:00
Greg Beaver
f870b8ae74 fix ZTS build and Phar::isValidPharFilename 2008-04-19 17:24:26 +00:00
Greg Beaver
c4f502fae0 COMPLETELY rework filename extension detection. Now the only requirements are:
1 - executable phars must contain '.phar' in the filename
2 - non-executable phars must not contain '.phar' and must have an extension of at least 1 character

In addition, phar filenames must exist if opened for read, and the directory containing the phar must exist if opened for creation
if opened for creation, the file must not already exist
[DOC]
2008-04-18 04:13:13 +00:00
Steph Fox
31596d1b45 - Fix ZTS build 2008-04-14 17:14:54 +00:00
Greg Beaver
0814b2df09 fix build if SPL is disabled 2008-04-12 21:43:39 +00:00
Greg Beaver
b0f281b159 restore Phar->compress/decompress() to simplify $phar->convertToExecutable(NULL, Phar::GZ) to $phar->compress(Phar::GZ)
[DOC]
2008-04-11 13:41:59 +00:00
Greg Beaver
8f28d19d4e cosmetics, extra space 2008-04-11 13:26:36 +00:00
Greg Beaver
3493fb6561 combine PharFileInfo->setCompressedGZ/setCompressedBZIP2 into compress() with parameter Phar::GZ or Phar::BZ2
use ZEND_ACC_PUBLIC in PharFileInfo definitions, to be consistent
[DOC]
2008-04-11 13:26:03 +00:00
Greg Beaver
ab34fcac05 merge PharFileInfo->isCompressed/isCompressedGZ/isCompressedBZIP2 by adding an
optional parameter to isCompressed for testing specific compression algorithm
[DOC]
2008-04-11 13:07:14 +00:00
Greg Beaver
c07a07ea68 change PharFileInfo->setUncompressed to decompress
[DOC]
2008-04-11 12:56:53 +00:00
Greg Beaver
c0d82e966f refactor compress/convertToTar/convertToPhar/convertToZip/convertToExecutable/convertToData
into 2 methods:
convertToExecutable/convertToData.  Both methods accept 3 optional parameters
1 archive type, Phar::PHAR, Phar::TAR, or Phar::ZIP
2 compression Phar::NONE, Phar::GZ, or Phar::BZ2
3 file extension.  Default is <format>.<compression> where .phar.tar is executable .tar
convertToExecutable always returns a Phar object
convertToData always returns a PharData object
also added Phar::PHAR, Phar::TAR, and Phar::ZIP class constants
[DOC]
2008-04-11 04:20:15 +00:00
Greg Beaver
f0ff6fb109 s/getContents/getContent/ 2008-04-10 13:41:29 +00:00
Greg Beaver
61b5fc48e3 re-factor all-file compression. Remove compressAllFilesGZ/compressAllFilesBZ2 in favor of
unifying compressFiles which accepts Phar::GZ or Phar::BZ2 as argument.  rename uncompressAllFiles to decompressFiles
2008-04-10 13:40:26 +00:00
Greg Beaver
06df9bff83 add Phar->isWritable() for detecting whether a phar archive can be written to based on phar.readonly combined with actual file permissions
[DOC]
2008-04-10 03:32:10 +00:00
Greg Beaver
abfc228f36 add addFile/addFromString/addEmptyDir. API is identical to ext/zip
[DOC]
2008-04-09 19:23:31 +00:00
Greg Beaver
e56beeeefd add PharFileInfo->getContents() to retrieve file contents
[DOC]
2008-04-09 18:12:41 +00:00
Greg Beaver
2e9fca4f0b fix read/write for PharData object, update tests to current API 2008-03-24 03:01:31 +00:00
Greg Beaver
b4b890cb8f check for invalid aliases, add tests for this and direct setting of stub/alias 2008-03-24 01:33:30 +00:00
Greg Beaver
cea3169ca6 prevent direct setting of stub or alias in tar/zip 2008-03-24 01:18:50 +00:00
Greg Beaver
95eeee9156 not all tests have been converted over to the new API, but it works
conversion is now split into 3 separate methods
1\) convertToZip\(\) convertToTar\(\) and convertToPhar\(\) exclusively change file format
2\) compress\(\) sets compression, accepting Phar::GZ, Phar::BZ2, or Phar::NONE
3\) convertToExecutable\(\) allows stub creation in tar/zip, convertToData\(\) prevents it

all methods return either Phar or PharData objects, allowing fluent interface.

only 1 test has been converted to the new format, but the API works
2008-03-23 22:42:45 +00:00
Greg Beaver
cac70206f2 add Phar->getPath() for retrieving the full path to the phar archive.
this is useful for renaming and also always returns the realpath()
2008-03-23 19:03:15 +00:00
Greg Beaver
ca92928b48 fix param parsing for Phar::running() to be optional
# this is the last bug for ZF app - it now works!
2008-03-23 17:36:57 +00:00
Greg Beaver
39c4f38c27 rename Phar::getRunningPhar\(\) to Phar::running\(\) and by default return the full
phar url, if optional parameter is false, return the path to the phar on disk.  Fix a double free on failed mount
2008-03-23 06:00:31 +00:00
Greg Beaver
15f8facded fix Bug #13110: using rewrite parameter to webPhar causes memory error 2008-03-22 22:56:04 +00:00
Greg Beaver
6cef8da201 move all blah++ to ++blah where possible for those with crapass compilers 2008-03-22 22:11:49 +00:00
Greg Beaver
1b05ce68d7 fix all frontcontroller tests - cgi sapi was not being detected, only fastcgi 2008-03-22 22:04:21 +00:00
Steph Fox
c0619c6523 Make versioning more standard 2008-03-22 17:09:24 +00:00
Marcus Boerger
e08556eb2e - Constify 2008-03-22 00:11:43 +00:00
Marcus Boerger
4d8073056c - Don't throw exception for uninitialized instance 2008-03-21 23:56:52 +00:00
Greg Beaver
891067c975 fix the memleak - but this breaks the \*compressAllFiles\*() methods because of fatal flaw
in renaming implementation - see pecl-dev email for details
2008-03-21 19:54:07 +00:00
Steph Fox
c11bcd5414 Deliberate test breakage (no idea how many) in an attempt to see where the valgrind 'bad news' is coming from on gcov.php.net. 2008-03-21 05:22:10 +00:00
Antony Dovgal
044f39293b fix 5_3 ZTS build 2008-03-17 08:55:56 +00:00
Marcus Boerger
58f7de98f4 - Fix build 2008-03-13 19:43:14 +00:00
Steph Fox
3ee08069a6 Rename archive during compressAllFiles*()
Note: this only works for tar archives at present pending a fix for bug #13352
2008-03-09 04:46:16 +00:00
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
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
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
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
f5ab70a3b9 Update reflection info 2008-02-25 12:21:19 +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
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
0e6457b2cf free spprintf'ed stub after using it 2008-02-23 14:59:52 +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
6cc2426ff1 A much better solution for setDefaultStub(). The convertTo*() fixes should be trivial now. 2008-02-21 00:24:38 +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
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
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
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
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
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
Greg Beaver
e864f512bb new test, free resources on error in webPhar() (thanks new test\!) 2008-01-05 05:47:47 +00:00
Greg Beaver
dd11d4f64e new test 2008-01-05 05:12:44 +00:00
Greg Beaver
b859c9dd4b beautify 404 error handler, and note missing file.
throw exception if webPhar() is attempted with an extracted file, as webPhar() makes no sense on-disk
2008-01-05 04:03:33 +00:00
Greg Beaver
08b7b76418 fix Location header for index if request has a /, 2 new tests, add index.php to frontcontroller phar 2008-01-05 03:49:01 +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
Marcus Boerger
4aec466e95 - Pendantic changes 2008-01-04 14:06:50 +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
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
b8592e228d make blah.phar/ access indexfile just like blah.phar 2007-12-29 02:40:49 +00:00
Greg Beaver
f56865ad4d fix redirects and s/redirects/rewrites/ 2007-12-29 02:38:29 +00:00
Greg Beaver
9320ac9893 remove FIXME - it's been fixed 2007-12-29 02:04:09 +00:00
Greg Beaver
3dcee1c8c7 fix index/custom 404 page 2007-12-29 02:01:12 +00:00
Greg Beaver
06a98d96c7 update proto, arginfo for webPhar 2007-12-29 01:37:12 +00:00
Greg Beaver
acc44900de add vastly improved 404 handling 2007-12-29 01:35:46 +00:00
Greg Beaver
60dc8e5ff4 fix redirect to index file 2007-12-28 23:33:15 +00:00
Greg Beaver
e1a41da652 fix on windows
# it works! it works!
2007-12-26 16:59:01 +00:00
Greg Beaver
4ae47c1df9 remove unused variable 2007-12-24 20:48:12 +00:00