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.
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]
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]
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
5.3 code expects the proposed patch for stream wrapper in include_path to be committed
5.2 code only supports phar stream wrapper in include_path.
this is a 2-step process. After this, more magic, particularly in funcinterceptors.c will be
converted to use phar_resolve_path, which is far safer than the current implementation.
this needs windows and 5.2 testing unix/windows
- 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.
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.
# 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
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
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
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
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
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
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]
fix *extremely* ancient problem where phar_wrapper_stat always returned success indicating the file existed
rename phar_destroy_manifest to phar_destroy_manifest_entry