Compare commits

..
Author SHA1 Message Date
SVN Migration db7b5b196a This commit was manufactured by cvs2svn to create tag 'SQLITE_4_3_20041227'. 2004-12-12 15:10:59 +00:00
Stanislav Malyshev fff93cdb7f another 64-bit fix - 's' in zend_parse_parameters uses int, so it should not get long * 2004-12-12 15:10:58 +00:00
Zeev Suraski 0230c72c0f Restore Makefile.frag - it's still needed for 4.2.x builds 2004-11-28 09:53:16 +00:00
Stanislav Malyshev 706aac5cb0 fix amd64 - long != int there 2004-11-26 13:08:37 +00:00
Ilia Alshanetsky 5c1b52a8e7 MFH: Fixed bug 29395 (sqlite_escape_string() returns bogus data on empty
strings).
2004-07-27 16:53:48 +00:00
Wez Furlong 0a925c90d4 prep for release.
Touch parse.c to avoid weird implicit bison make rule breaking build
2004-07-18 10:31:35 +00:00
Wez Furlong a4b685078b tweak release notes
# why do I have such a hard time typing sqlite version numbers? :)
2004-07-10 13:15:45 +00:00
Wez Furlong 4959eb1b5f Fix #28402: no need for -ldl 2004-07-10 12:50:18 +00:00
Wez Furlong 20ad0b9668 this is no longer needed 2004-07-10 12:26:32 +00:00
Wez Furlong 902f9d52cf Upgrade bundled library to 2.8.14 + misc fixes
(http://www.sqlite.org/cvstrac/chngview?cn=1742)
2004-07-10 12:25:35 +00:00
Ilia Alshanetsky 1da45c2873 Fixed bug #1713 (possible crash inside tidy_get_error_buffer()). 2004-06-24 14:17:03 +00:00
Ilia Alshanetsky 7de1333bb2 MFH: Fixed bug #1580 (Tidy configuration settings leak memory). 2004-06-08 14:58:55 +00:00
Ilia Alshanetsky c111b20564 Do not attempt to use configuration file/array if one is not specified. 2004-05-17 21:16:11 +00:00
Ilia Alshanetsky b6a9bdfb4f Better fix for a possible double free in sqlite_single|array_query() when
a failure occurs between query execution and data retrieval.
2004-05-16 19:49:18 +00:00
Stanislav Malyshev e145ab54da attempt to fix double free on failed query 2004-05-16 16:34:27 +00:00
Stanislav Malyshev 49a1413f50 add sqlite_exec - now to the right tag 2004-05-13 14:54:55 +00:00
Ilia Alshanetsky 395478d363 Fixed a memory leak when retrieving string ini settings.
Allow tidy_repair_(file|string) to accept an option array and not just a
path to the config file.
2004-05-11 16:21:18 +00:00
Marcus Boerger e40f99303c MFH 2004-04-29 22:58:31 +00:00
Marcus Boerger 247f707d55 MFH 2004-04-22 22:52:54 +00:00
Ilia Alshanetsky 437c556926 MFH: Fixed bug #28112 (Empty queries may result in crashes). 2004-04-22 22:36:14 +00:00
SVN Migration a007611a4f This commit was manufactured by cvs2svn to create branch 'PECL_4_3'. 2004-04-22 22:29:42 +00:00
Ilia Alshanetsky f9073ef5a0 MFH: Open basedir & safe_mode exception when copying or attaching to a
memory only database.
2004-04-11 18:53:36 +00:00
Ilia Alshanetsky d478d178bf MFH: Fixed bug #27928 (sqlite incorrectly handles invalid filenames). 2004-04-09 18:02:18 +00:00
Ilia Alshanetsky 230aea0ff8 MFH: Corrected string escape calculation. 2004-03-07 21:58:19 +00:00
Ilia Alshanetsky 8080b6bbd3 MFH: Fixed possible crash inside sqlite_escape_string() and
sqlite_udf_encode_binary().
2004-02-27 00:30:45 +00:00
SVN Migration 3d08abbc77 This commit was manufactured by cvs2svn to create branch 'PECL_4_3'. 2004-02-27 00:29:11 +00:00
Edin Kadribasic d8e9ed9ada Correct .dsp in correct branch 2004-01-28 23:02:28 +00:00
John Coggeshall 289fb87a5e Cleaning up the 4.3 branch to remove the ZE2 stuff that was laying around
and fixed a bug we fixed earlier in HEAD
2004-01-21 11:36:30 +00:00
SVN Migration 6b642ebfc5 This commit was manufactured by cvs2svn to create branch 'PECL_4_3'. 2004-01-17 13:00:39 +00:00
Wez Furlong 985f1c2c60 bah bah 2004-01-17 01:07:22 +00:00
Wez Furlong 605e6aa687 I will test package even at 1am... 2004-01-17 01:04:46 +00:00
Wez Furlong c10af70d05 update for release 2004-01-17 00:55:48 +00:00
Wez Furlong e5183a19e5 better fix 2004-01-17 00:33:14 +00:00
Edin Kadribasic 16a02bafc2 Not everybody has this ;) 2004-01-17 00:29:37 +00:00
Wez Furlong e736c01e44 fix win32 build 2004-01-17 00:17:37 +00:00
Marcus Boerger 96320611a3 Fix shutdown 2004-01-15 21:29:04 +00:00
Edin Kadribasic ae2e30d461 Update version number 2004-01-14 22:40:31 +00:00
Edin Kadribasic 20590a100b Add new files to windows build 2004-01-14 22:24:26 +00:00
Ilia Alshanetsky cd7461d5f1 Added new files. 2004-01-14 22:12:27 +00:00
Ilia Alshanetsky ed150e2312 MFH: Fixed bug #26911 (crash in sqlite extension when fetching data from
empty queries).
2004-01-14 21:19:48 +00:00
SVN Migration cd9a7fe277 This commit was manufactured by cvs2svn to create branch 'PECL_4_3'. 2004-01-14 21:17:10 +00:00
Ilia Alshanetsky a508453b1c Touch parser. 2004-01-14 18:00:06 +00:00
Ilia Alshanetsky b10c1ea433 Upgrade bundled libsqlite to 2.8.11 2004-01-14 17:59:08 +00:00
Marcus Boerger 879184bd6d Fixed Bug #25329 sqlite_create_function with method and reference to $this 2003-12-27 22:20:56 +00:00
Ilia Alshanetsky 02de761345 MFH: do not mangle column names. 2003-12-14 18:47:14 +00:00
Ilia Alshanetsky 7a6246385f MFH: Added myself to credits. 2003-11-16 20:44:06 +00:00
Ilia Alshanetsky ca4116ace5 Add myself to credits 2003-09-19 12:24:36 +00:00
Marcus Boerger 05910c2415 # Wez, your whish is my command 2003-08-12 21:29:57 +00:00
Marcus Boerger 5a482f71e3 MFH: Bugfix #25056 2003-08-12 21:25:56 +00:00
Marcus Boerger 70b9e3ba14 Fix test 2003-08-09 09:10:00 +00:00
foobar 8347c1a487 MFH 2003-07-19 12:44:54 +00:00
Wez Furlong bcd4c34c9b MFH TSRMLS fix 2003-07-14 19:36:19 +00:00
Wez Furlong 8f8421714b A much better fix for the popen problem
# no thanks to Jolt Cola
2003-07-13 09:20:05 +00:00
Wez Furlong c987b05b70 Fix bug #24575 (sqlite_popen did not request a new resource id when persistent
handles were re-used within a request).
2003-07-13 08:49:07 +00:00
Marcus Boerger 058c419fd2 MFH: Fix bug #24540 2003-07-08 18:58:59 +00:00
Marcus Boerger 8a6d3f31a7 MFH: Add test for sqlite_seek() 2003-07-08 18:58:36 +00:00
SVN Migration 2b7d0b008f This commit was manufactured by cvs2svn to create branch 'PECL_4_3'. 2003-07-08 18:56:15 +00:00
Marcus Boerger 5b7ee0399f Function was renamed (don't test an alias) 2003-06-26 21:32:37 +00:00
Marcus Boerger fd987209eb (MFH) fix warnings 2003-06-26 21:30:17 +00:00
Marcus Boerger a01c31f949 MFH: Rename sqlite_fetch_string() to sqlite_fetch_single() + alias 2003-06-26 21:10:10 +00:00
Marcus Boerger f38261cb0d MFH: fix memleak 2003-06-26 21:03:12 +00:00
Edin Kadribasic 1b69324b83 Seems to work 2003-06-26 18:30:12 +00:00
Edin Kadribasic be2bbbf1fb Testing pecl-cvs 2003-06-26 18:29:45 +00:00
Edin Kadribasic fafae95684 Removed files from PECL_4_3 branch that belong only in head. 2003-06-26 14:10:10 +00:00
Ilia Alshanetsky 0d9e627878 MFH: zts typo 2003-06-26 13:40:25 +00:00
Edin Kadribasic dd1ee78e9e SQLite PHP_4_3 is dead. Long live SQLite PECL_4_3! 2003-06-26 12:11:29 +00:00
SVN Migration ab4de7dc9e This commit was manufactured by cvs2svn to create branch 'PECL_4_3'. 2003-06-25 23:21:11 +00:00
226 changed files with 46395 additions and 15878 deletions

No files matched your search

-2
View File
@@ -1,2 +0,0 @@
phar
Gregory Beaver, Marcus Boerger
-68
View File
@@ -1,68 +0,0 @@
--------------------------------------------------------------------
The PHP License, version 3.01
Copyright (c) 1999 - 2005 The PHP Group. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, is permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The name "PHP" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact group@php.net.
4. Products derived from this software may not be called "PHP", nor
may "PHP" appear in their name, without prior written permission
from group@php.net. You may indicate that your software works in
conjunction with PHP by saying "Foo for PHP" instead of calling
it "PHP Foo" or "phpfoo"
5. The PHP Group may publish revised and/or new versions of the
license from time to time. Each version will be given a
distinguishing version number.
Once covered code has been published under a particular version
of the license, you may always continue to use it under the terms
of that version. You may also choose to use such covered code
under the terms of any subsequent version of the license
published by the PHP Group. No one other than the PHP Group has
the right to modify the terms applicable to covered code created
under this License.
6. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes PHP software, freely available from
<http://www.php.net/software/>".
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------
This software consists of voluntary contributions made by many
individuals on behalf of the PHP Group.
The PHP Group can be contacted via Email at group@php.net.
For more information on the PHP Group and the PHP project,
please see <http://www.php.net>.
PHP includes the Zend Engine, freely available at
<http://www.zend.com>.
-25
View File
@@ -1,25 +0,0 @@
$(srcdir)/phar_path_check.c: $(srcdir)/phar_path_check.re
$(RE2C) -b -o $(srcdir)/phar_path_check.c $(srcdir)/phar_path_check.re)
pharcmd: $(builddir)/phar.php $(builddir)/phar.phar
$(builddir)/phar.php: $(srcdir)/build_precommand.php $(srcdir)/phar/*.inc $(srcdir)/phar/*.php $(SAPI_CLI_PATH)
if test -x "$(PHP_EXECUTABLE)"; then \
export PHP="$(PHP_EXECUTABLE)"; \
else \
export PHP="$(top_builddir)/$(SAPI_CLI_PATH)"; \
fi; \
$$PHP $(srcdir)/build_precommand.php > $(builddir)/phar.php
$(builddir)/phar.phar: $(builddir)/phar.php $(srcdir)/phar/*.inc $(srcdir)/phar/*.php $(SAPI_CLI_PATH)
if test -x "$(PHP_EXECUTABLE)"; then \
export PHP="$(PHP_EXECUTABLE)"; \
export BANG="$(PHP_EXECUTABLE)"; \
else \
export PHP="$(top_builddir)/$(SAPI_CLI_PATH)"; \
export BANG="$(INSTALL_ROOT)$(bindir)/$(program_prefix)php$(program_suffix)$(EXEEXT)"; \
fi; \
$$PHP -d phar.readonly=0 $(srcdir)/phar.php pack -f $(builddir)/phar.phar -a pharcommand -c auto -x CVS -p 0 -s $(srcdir)/phar/phar.php -h sha1 -b "$$BANG" $(srcdir)/phar/
@chmod +x $(builddir)/phar.phar
-77
View File
@@ -1,77 +0,0 @@
Version 1.0.0
X make permissions in the lowest bits of flags to simplify using them [Greg]
X implement ini handler for phar.readonly and phar.require_hash that allows
enabling it on PHP_INI_ALL if it is disabled in the system, but does not
allow disabling it if it is enabled in the system [Greg]
X implement reading in metadata in manifest as <len32><metadata...> [Marcus]
X implement writing out of metadata to new manifest [Marcus]
X if SPL is disabled, enable only static methods of class Phar and disable
class PharFileInfo completely [Marcus]
X implement in-phar locking, so that a file that is opened for reading can't
have a handle opened for writing [Marcus/Greg]
X docs on file format/manifest description [Greg]
X docs on uses [Greg]
X stream context for specifying compression of a file [Marcus]
X stream context for specifying meta-data [Greg]
X Phar->begin()/Phar->commit() for specifying a new stub to the phar,
and deferring flush until all modifications are complete [Greg]
X Phar->getStub() for retrieving the stub of the phar [Marcus]
X add setUncompressed(), setCompressedGZ() and setCompressedBZ2() to
PharFileInfo class [Greg]
X add uncompressAllFiles(), compressAllFilesGZ() and compressAllFilesBZ2()
to Phar class [Greg]
X add PharFileInfo::setMetaData($metadata) [Marcus]
X add PharFileInfo::getMetaData() [Marcus]
X always throw exceptions from the Phar object, and E_RECOVERABLE_ERROR from
streams interface [Greg]
X Phar archive metadata Phar::setMetaData($metadata) Phar::getMetaData() [Greg]
X support rename() in stream wrapper [Greg]
X update docs to reflect changes in error handling [Greg]
X fix 011.phpt, 029.phpt for uncaught exceptions causing bad cleanup [Marcus/Greg]
Version 1.1.0
X Ability connect a phar file 'phar://whatever' to a directory. That way all
access to that phar archive are directed to the extracted directory. This
allows to have the installed files and the archieve keep the same includes.
[Marcus]
X add SHA-2 (256, 512) support [Marcus]
X setSignatureAlgorithm() and Phar::MD5 Phar::SHA1 Phar::SHA256 Phar::SHA512 Phar::PGP to
choose the kind of signature to use (PGP falls back to SHA1) [Greg]
Version 1.2.0
X add PharFileInfo::hasMetadata(), PharFileInfo::delMetadata() [Marcus]
X add Phar::hasMetadata(), Phar::delMetadata() [Marcus]
X fix Phar::CanWrite() [Marcus]
X add preliminary phar command (phar.php) [Marcus]
X add phar command (phar.phar) [Marcus]
X list all available compression methods using Phar::getSupportedCompression() [Marcus]
X Remove RINIT [Marcus]
Version 1.2.1
X Add Phar::getAlias() [Marcus]
X Add Phar::setAlias() [Greg]
X Make -a optional in pack subcommand of phar.phar [Marcus]
X Make Phar::loadPhar() and Phar::mapPhar() ignore extracted archives
Version 1.3.0
* Provide an additional header that allows better compatibility with PHP 4
__HALT_COMPILER();function __HALT_COMPILER(){}$a=<<<PHARDATABEGIN\n
* ability to have Phar object return file class as offsetGet() result
* ability to store empty directories
* [optional] Phar->rollback() to abort a write transaction
* implement PPG signing
* ability to match files containing a metadata key opendir('phar://a.phar/?mime-type=image/jpeg')
or foreach ($p->match('mime-type', 'image/jpeg') as $file)
* Phar::copy($from, $to);
X Phar::delete($what) [Greg]
* Phar::buildFromIterator($filename, Iterator $it, array $addinfo = null);
$addinfo = array('alias','flags','metadata','stub'...)
* Layout: Option to compress all content rather than single files.
That excludes stub and manifest haeder.
* stream context option for cleaning crap paths like phar://blah.phar/file//to\\here.php
-60
View File
@@ -1,60 +0,0 @@
#!/usr/bin/php
<?php echo '<'.'?php';?>
/** @file phar.php
* @ingroup Phar
* @brief class Phar Pre Command
* @author Marcus Boerger
* @date 2007 - 2007
*
* Phar Command
*/
foreach(array("SPL", "Reflection", "Phar") as $ext)
{
if (!extension_loaded($ext))
{
echo "$argv[0] requires PHP extension $ext.\n";
exit(1);
}
}
<?php
$classes = array(
'DirectoryTreeIterator',
'DirectoryGraphIterator',
'InvertedRegexIterator',
'CLICommand',
'PharCommand',
);
foreach($classes as $name)
{
echo "if (!class_exists('$name', 0))\n{\n";
$f = file(dirname(__FILE__) . '/phar/' . strtolower($name) . '.inc');
unset($f[0]);
$c = count($f);
while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n"))
{
unset($f[$c--]);
}
if (substr($f[$c], -2) == "\r\n") {
$f[$c] = substr($f[$c], 0, -2);
}
if (substr($f[$c], -1) == "\n") {
$f[$c] = substr($f[$c], 0, -1);
}
if (substr($f[$c], -2) == '?>') {
$f[$c] = substr($f[$c], 0,-2);
}
while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n"))
{
unset($f[$c--]);
}
echo join('', $f);
echo "\n}\n\n";
}
echo 'new PharCommand($argc, $argv);'."\n";
?>
-14
View File
@@ -1,14 +0,0 @@
dnl $Id$
dnl config.m4 for extension phar
PHP_ARG_ENABLE(phar, for phar support/phar zlib support,
[ --enable-phar Enable phar support, use --with-zlib-dir if zlib detection fails])
if test "$PHP_PHAR" != "no"; then
PHP_NEW_EXTENSION(phar, phar.c phar_object.c phar_path_check.c phar2.c phar2_openhash.c, $ext_shared)
PHP_ADD_EXTENSION_DEP(phar, zlib, false)
PHP_ADD_EXTENSION_DEP(phar, bz2, false)
PHP_ADD_EXTENSION_DEP(phar, spl, false)
PHP_ADD_EXTENSION_DEP(phar, gnupg, false)
PHP_ADD_MAKEFILE_FRAGMENT
fi
-12
View File
@@ -1,12 +0,0 @@
// $Id$
// vim:ft=javascript
ARG_ENABLE("phar", "enable phar support", "no");
if (PHP_PHAR != "no") {
EXTENSION("phar", "phar.c phar_object.c phar_path_check.c");
ADD_EXTENSION_DEP('phar', 'zlib', false);
ADD_EXTENSION_DEP('phar', 'bz2', false);
ADD_EXTENSION_DEP('phar', 'spl', false);
ADD_EXTENSION_DEP('phar', 'gnupg', false);
}
-117
View File
@@ -1,117 +0,0 @@
define ___pharglobals
if basic_functions_module.zts
set $tsrm_ls = ts_resource_ex(0, 0)
set $pharglobals = ((zend_executor_globals) (*((void ***) $tsrm_ls))[phar_globals_id-1])
else
set $pharglobals = phar_globals
end
end
define ____print_pharht
set $ht = $arg0
set $p = $ht.pListHead
while $p != 0
set $i = $ind
while $i > 0
printf " "
set $i = $i - 1
end
set $temp = *(phar_archive_data*)$p->pDataPtr
____print_str $temp.fname $temp.fname_len
printf " => "
if $arg1 == 0
printf "%i (alias ", $temp.refcount
____print_str $temp.alias $temp.alias_len
printf ")\n"
end
set $p = $p->pListNext
end
end
define print_phar
set $ind = 1
___pharglobals
printf "{"
____print_pharht $pharglobals.phar_fname_map 0
printf "}\n"
end
document print_phar
dumps open phars and their aliases
end
define print_pharfp
___pharglobals
set $ht = $pharglobals.phar_fname_map
set $p = $ht.pListHead
set $fpcount = 0
while $p != 0
set $pharname = (*(phar_archive_data*)$p->pDataPtr).fname
set $pharrefcount = (*(phar_archive_data*)$p->pDataPtr).refcount
if (*(phar_archive_data*)$p->pDataPtr).fp != 0
set $fpcount = $fpcount + 1
printf "phar %s is open (%i)\n", $pharname, $pharrefcount
end
set $manifest = (*(phar_archive_data*)$p->pDataPtr).manifest
set $m = $manifest.pListHead
while $m != 0
if (*(phar_entry_info *)$m->pData).fp
set $fpcount = $fpcount + 1
set $a = (*(phar_entry_info *)$m->pData).fp_refcount
printf "phar %s file %s is open (%i)\n", $pharname, (*(phar_entry_info *)$m->pData).filename, $a
end
set $m = $m->pListNext
end
set $p = $p->pListNext
end
printf "Open file pointers: %d\n", $fpcount
end
document print_pharfp
displays all open file pointers in phar, and the phars plus entries that are open with reference counts
end
define dump_entry
___pharglobals
set $ht = $pharglobals.phar_fname_map
set $p = $ht.pListHead
set $done = 0
while $p != 0
set $t = (*(phar_archive_data*)$p->pDataPtr)
if $t.fname[0] == $arg0[0] || $t.alias[0] == $arg0[0]
set $manifest = (*(phar_archive_data*)$p->pDataPtr).manifest
set $m = $manifest.pListHead
while $m != 0
if (*(phar_entry_info *)$m->pData).filename[0] == $arg1[0]
if $argc == 3
output *((phar_entry_info *)$m->pData)->fp
end
if $argc == 2
output *(phar_entry_info *)$m->pData
end
printf "\n"
set $done = 1
loop_break
end
set $m = $m->pListNext
end
end
if $done == 1
loop_break
end
set $p = $p->pListNext
end
end
document dump_entry
dump_entry "pharname"|"pharalias" "filename" [1]
display phar_entry_info for a file within a phar. If the optional third param
is passed in, displays the php_stream that is the file's fp
end
-68
View File
@@ -1,68 +0,0 @@
<?php
$notes = '
* add Phar::delete() [Greg]
';
if (!class_exists("Phar") && !extension_loaded("Phar")) {
die("Extension phar not present");
}
require_once 'PEAR/PackageFileManager2.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$options = array(
'filelistgenerator' => 'CVS',
'changelogoldtonew' => false,
'simpleoutput' => true,
'baseinstalldir' => '/',
'packagedirectory' => dirname(__FILE__),
'packagefile' => 'package.xml',
'clearcontents' => true,
'ignore' => array('package*.php', 'package*.xml'),
'dir_roles' => array(
'docs' => 'doc',
'examples' => 'doc',
'tests' => 'test',
'phar' => 'src',
),
'exceptions' => array(
'CREDITS' => 'doc',
'EXPERIMENTAL' => 'doc',
'LICENSE' => 'doc',
'Makefile.frag' => 'src',
'phar_path_check.re' => 'src',
'TODO' => 'doc',
'phar.phar' => 'script',
),
);
$package = PEAR_PackageFileManager2::importOptions(dirname(__FILE__) . '/package.xml', $options);
$package->clearDeps();
$package->setPhpDep('5.2.0');
$package->setPearInstallerDep('1.4.3');
$package->addPackageDepWithChannel('optional', 'bz2', 'pecl.php.net', false, false, false, false, 'bz2');
// all this false business sets the <providesextension> tag that allows us to have hash built
// in statically
$package->addPackageDepWithChannel('optional', 'hash', 'pecl.php.net', false, false, false, false, 'hash');
$package->addExtensionDep('optional', 'spl');
$package->addExtensionDep('optional', 'zlib');
$package->setPackageType('extsrc');
$package->addRelease();
$package->setReleaseVersion(phpversion('phar'));
$package->setAPIVersion(Phar::apiVersion());
$package->setReleaseStability('stable');
$package->setAPIStability('stable');
$package->setNotes("\n$notes\n");
//$package->addGlobalReplacement('package-info', '@package_version@', 'version');
$package->generateContents();
if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) {
$package->writePackageFile();
} else {
$package->debugPackageFile();
}
?>
-319
View File
@@ -1,319 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.6.2" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>phar</name>
<channel>pecl.php.net</channel>
<summary>allows running of complete applications out of .phar files (like Java .jar files)</summary>
<description>This is the extension version of PEAR&apos;s PHP_Archive package. Support for
zlib, bz2 and crc32 is achieved without any dependency other than the external
zlib or bz2 extension.
.phar files can be read using the phar stream, or with the Phar class. If the SPL extension
is available, a Phar object can be used as an array to iterate over a phar&apos;s contents
or to read files directly from the phar.
Phar archives can be created using the streams API or with the Phar class, if
the phar.readonly ini variable is set to false.
Full support for MD5 and SHA1 signatures is possible. Signatures can be required
if the ini variable phar.require_hash is set to true. When PECL extension hash is
avaiable then SHA-256 and SHA-512 signatures are supported as well.</description>
<lead>
<name>Greg Beaver</name>
<user>cellog</user>
<email>cellog@php.net</email>
<active>yes</active>
</lead>
<lead>
<name>Marcus Boerger</name>
<user>helly</user>
<email>helly@php.net</email>
<active>yes</active>
</lead>
<date>2007-08-24</date>
<time>20:06:43</time>
<version>
<release>1.2.1</release>
<api>1.1.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* add Phar::setAlias() [Greg]
* fix too many open file handles issue [Greg]
* fix rename [Greg]
* add Phar::getAlias() [Marcus]
* Made -a optional in pack subcommand of phar.phar [Marcus]
* Fix issue with apache module and extracted archives [Marcus]
* Send all error messages to stderr in phar.phar [Marcus]
* Added new subcommands add and delete to phar.phar [Marcus]
* Made Phar::loadPhar() and Phar::mapPhar() ignore extracted archives [Marcus]
* Fix issue with compressed entries and uncompressing entries [Marcus]
* Verify stubs before writing [Marcus]
* Always use longest stub end to avoid issues with length field [Marcus]
</notes>
<contents>
<dir baseinstalldir="/" name="/">
<dir name="phar">
<file name="clicommand.inc" role="src" />
<file name="directorygraphiterator.inc" role="src" />
<file name="directorytreeiterator.inc" role="src" />
<file name="invertedregexiterator.inc" role="src" />
<file name="phar.inc" role="src" />
<file name="phar.php" role="src" />
<file name="pharcommand.inc" role="src" />
<file name="phar.phar" role="php" />
</dir> <!-- /phar -->
<dir name="tests">
<file name="001.phpt" role="test" />
<file name="002.phpt" role="test" />
<file name="003.phpt" role="test" />
<file name="003a.phpt" role="test" />
<file name="004.phpt" role="test" />
<file name="005.phpt" role="test" />
<file name="006.phpt" role="test" />
<file name="007.phpt" role="test" />
<file name="008.phpt" role="test" />
<file name="009.phpt" role="test" />
<file name="010.phpt" role="test" />
<file name="011.phpt" role="test" />
<file name="012.phpt" role="test" />
<file name="013.phpt" role="test" />
<file name="014.phpt" role="test" />
<file name="015.phpt" role="test" />
<file name="015b.phpt" role="test" />
<file name="016.phpt" role="test" />
<file name="016b.phpt" role="test" />
<file name="017.phpt" role="test" />
<file name="018.phpt" role="test" />
<file name="019.phpt" role="test" />
<file name="019b.phpt" role="test" />
<file name="019c.phpt" role="test" />
<file name="020.phpt" role="test" />
<file name="021.phpt" role="test" />
<file name="022.phpt" role="test" />
<file name="023.phpt" role="test" />
<file name="024.phpt" role="test" />
<file name="025.phpt" role="test" />
<file name="026.phpt" role="test" />
<file name="027.phpt" role="test" />
<file name="028.phpt" role="test" />
<file name="029.phpt" role="test" />
<file name="030.phpt" role="test" />
<file name="031.phpt" role="test" />
<file name="032.phpt" role="test" />
<file name="033.phpt" role="test" />
<file name="033a.phpt" role="test" />
<file name="create_new_and_modify.phpt" role="test" />
<file name="create_new_phar.phpt" role="test" />
<file name="create_new_phar_b.phpt" role="test" />
<file name="create_new_phar_c.phpt" role="test" />
<file name="create_path_error.phpt" role="test" />
<file name="delete_in_phar.phpt" role="test" />
<file name="delete_in_phar_b.phpt" role="test" />
<file name="delete_in_phar_confirm.phpt" role="test" />
<file name="extracted.inc" role="test" />
<file name="extracted_001.phpt" role="test" />
<file name="ini_set.phpt" role="test" />
<file name="ini_set_off.phpt" role="test" />
<file name="metadata_read.phpt" role="test" />
<file name="metadata_write.phpt" role="test" />
<file name="metadata_write_commit.phpt" role="test" />
<file name="open_for_write_existing.phpt" role="test" />
<file name="open_for_write_existing_b.phpt" role="test" />
<file name="open_for_write_existing_c.phpt" role="test" />
<file name="open_for_write_newfile.phpt" role="test" />
<file name="open_for_write_newfile_b.phpt" role="test" />
<file name="open_for_write_newfile_c.phpt" role="test" />
<file name="phar_begin_setstub_commit.phpt" role="test" />
<file name="phar_commitwrite.phpt" role="test" />
<file name="phar_create_in_cwd.phpt" role="test" />
<file name="phar_ctx_001.phpt" role="test" />
<file name="phar_get_suppoted_signatures_001.phpt" role="test" />
<file name="phar_get_suppoted_signatures_002.phpt" role="test" />
<file name="phar_metadata_read.phpt" role="test" />
<file name="phar_metadata_write.phpt" role="test" />
<file name="phar_offset_get_error.phpt" role="test" />
<file name="phar_oo_001.phpt" role="test" />
<file name="phar_oo_002.phpt" role="test" />
<file name="phar_oo_003.phpt" role="test" />
<file name="phar_oo_004.phpt" role="test" />
<file name="phar_oo_005.phpt" role="test" />
<file name="phar_oo_006.phpt" role="test" />
<file name="phar_oo_007.phpt" role="test" />
<file name="phar_oo_008.phpt" role="test" />
<file name="phar_oo_009.phpt" role="test" />
<file name="phar_oo_010.phpt" role="test" />
<file name="phar_oo_011.phpt" role="test" />
<file name="phar_oo_011b.phpt" role="test" />
<file name="phar_oo_012.phpt" role="test" />
<file name="phar_oo_012b.phpt" role="test" />
<file name="phar_oo_012_confirm.phpt" role="test" />
<file name="phar_oo_compressallbz2.phpt" role="test" />
<file name="phar_oo_compressallgz.phpt" role="test" />
<file name="phar_oo_compressed_001.phpt" role="test" />
<file name="phar_oo_compressed_001b.phpt" role="test" />
<file name="phar_oo_compressed_002.phpt" role="test" />
<file name="phar_oo_compressed_002b.phpt" role="test" />
<file name="phar_oo_test.inc" role="test" />
<file name="phar_oo_uncompressall.phpt" role="test" />
<file name="phar_setalias.phpt" role="test" />
<file name="phar_setalias2.phpt" role="test" />
<file name="phar_setsignaturealgo1.phpt" role="test" />
<file name="phar_setsignaturealgo2.phpt" role="test" />
<file name="phar_stub.phpt" role="test" />
<file name="phar_stub_error.phpt" role="test" />
<file name="phar_stub_write.phpt" role="test" />
<file name="phar_stub_write_file.phpt" role="test" />
<file name="phar_test.inc" role="test" />
<file name="refcount1.phpt" role="test" />
<file name="rename.phpt" role="test" />
</dir> <!-- /tests -->
<file name="build_precommand.php" role="php" />
<file name="config.m4" role="src" />
<file name="config.w32" role="src" />
<file name="CREDITS" role="doc" />
<file name="gdbhelp" role="data" />
<file name="LICENSE" role="doc" />
<file name="Makefile.frag" role="src" />
<file name="phar.c" role="src" />
<file name="phar.phar" role="data" />
<file name="phar_internal.h" role="src" />
<file name="phar_object.c" role="src" />
<file name="phar_path_check.c" role="src" />
<file name="phar_path_check.re" role="src" />
<file name="php_phar.h" role="src" />
<file name="TODO" role="doc" />
</dir> <!-- / -->
</contents>
<dependencies>
<required>
<php>
<min>5.2.0</min>
</php>
<pearinstaller>
<min>1.4.3</min>
</pearinstaller>
</required>
<optional>
<package>
<name>bz2</name>
<channel>pecl.php.net</channel>
<providesextension>bz2</providesextension>
</package>
<package>
<name>hash</name>
<channel>pecl.php.net</channel>
<providesextension>hash</providesextension>
</package>
<extension>
<name>spl</name>
</extension>
<extension>
<name>zlib</name>
</extension>
</optional>
</dependencies>
<providesextension>phar</providesextension>
<extsrcrelease />
<changelog>
<release>
<version>
<release>1.2.1</release>
<api>1.1.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2007-08-24</date>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* add Phar::setAlias() [Greg]
* fix too many open file handles issue [Greg]
* fix rename [Greg]
* add Phar::getAlias() [Marcus]
* Made -a optional in pack subcommand of phar.phar [Marcus]
* Fix issue with apache module and extracted archives [Marcus]
* Send all error messages to stderr in phar.phar [Marcus]
* Added new subcommands add and delete to phar.phar [Marcus]
* Made Phar::loadPhar() and Phar::mapPhar() ignore extracted archives [Marcus]
* Fix issue with compressed entries and uncompressing entries [Marcus]
* Verify stubs before writing [Marcus]
* Always use longest stub end to avoid issues with length field [Marcus]
</notes>
</release>
<release>
<version>
<release>1.2.0</release>
<api>1.1.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2007-05-18</date>
<license uri="http://www.php.net/license">PHP License</license>
<notes>* add PharFileInfo::hasMetadata(), PharFileInfo::delMetadata() [Marcus]
* add Phar::hasMetadata(), Phar::delMetadata() [Marcus]
* fix Phar::CanWrite() [Marcus]
* add preliminary phar command (phar.php) [Marcus]
* add phar command (phar.phar) [Marcus]
* list all available compression methods using Phar::getSupportedCompression() [Marcus]
* remove RINIT [Marcus]</notes>
</release>
<release>
<version>
<release>1.1.0</release>
<api>1.1.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2007-04-12</date>
<license uri="http://www.php.net/license">PHP License</license>
<notes>* implement ability connect a phar file &apos;phar://whatever&apos; to a directory. That way all
access to that phar archive are directed to the extracted directory. This
allows to have the installed files and the archieve keep the same includes.
[Marcus]
* implement SHA-2 (256, 512) support [Marcus]
* implement setSignatureAlgorithm() and Phar::MD5 Phar::SHA1 Phar::SHA256 Phar::SHA512 Phar::PGP to
choose the kind of signature to use (PGP falls back to SHA1) [Greg]</notes>
</release>
<release>
<version>
<release>1.0.1</release>
<api>1.0.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2007-03-28</date>
<license uri="http://www.php.net/license">PHP License</license>
<notes>* Fix return value of unlink() and rename() when used for phar archievs. [Marcus]</notes>
</release>
<release>
<version>
<release>1.0.0</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2007-03-26</date>
<license uri="http://www.php.net/license">PHP License</license>
<notes>*BACKWARDS COMPATIBILITY BREAK*
Rename Phar-&gt;begin/isFlushingToPhar/commit to startBuffering/isBuffering/stopBuffering
Note that isBuffering() returns the opposite value to isFlushingToPhar()</notes>
</release>
</changelog>
</package>
-3958
View File
File diff suppressed because it is too large. Load diff
-948
View File
@@ -1,948 +0,0 @@
<?php if (!class_exists('PHP_Archive')) {
?><?php
/**
* PHP_Archive Class (implements .phar)
*
* @package PHP_Archive
* @category PHP
*/
/**
* PHP_Archive Class (implements .phar)
*
* PHAR files a singular archive from which an entire application can run.
* To use it, simply package it using {@see PHP_Archive_Creator} and use phar://
* URIs to your includes. i.e. require_once 'phar://config.php' will include config.php
* from the root of the PHAR file.
*
* Gz code borrowed from the excellent File_Archive package by Vincent Lascaux.
*
* @copyright Copyright David Shafik and Synaptic Media 2004. All rights reserved.
* @author Davey Shafik <davey@synapticmedia.net>
* @author Greg Beaver <cellog@php.net>
* @link http://www.synapticmedia.net Synaptic Media
* @version $Id: Archive.php,v 1.38 2007/02/06 04:31:45 cellog Exp $
* @package PHP_Archive
* @category PHP
*/
class PHP_Archive
{
const GZ = 0x00001000;
const BZ2 = 0x00002000;
const SIG = 0x00010000;
const SHA1 = 0x0002;
const MD5 = 0x0001;
/**
* Whether this archive is compressed with zlib
*
* @var bool
*/
private $_compressed;
/**
* @var string Real path to the .phar archive
*/
private $_archiveName = null;
/**
* Current file name in the phar
* @var string
*/
protected $currentFilename = null;
/**
* Length of current file in the phar
* @var string
*/
protected $internalFileLength = null;
/**
* Current file statistics (size, creation date, etc.)
* @var string
*/
protected $currentStat = null;
/**
* @var resource|null Pointer to open .phar
*/
protected $fp = null;
/**
* @var int Current Position of the pointer
*/
protected $position = 0;
/**
* Map actual realpath of phars to meta-data about the phar
*
* Data is indexed by the alias that is used by internal files. In other
* words, if a file is included via:
* <code>
* require_once 'phar://PEAR.phar/PEAR/Installer.php';
* </code>
* then the alias is "PEAR.phar"
*
* Information stored is a boolean indicating whether this .phar is compressed
* with zlib, another for bzip2, phar-specific meta-data, and
* the precise offset of internal files
* within the .phar, used with the {@link $_manifest} to load actual file contents
* @var array
*/
private static $_pharMapping = array();
/**
* Map real file paths to alias used
*
* @var array
*/
private static $_pharFiles = array();
/**
* File listing for the .phar
*
* The manifest is indexed per phar.
*
* Files within the .phar are indexed by their relative path within the
* .phar. Each file has this information in its internal array
*
* - 0 = uncompressed file size
* - 1 = timestamp of when file was added to phar
* - 2 = offset of file within phar relative to internal file's start
* - 3 = compressed file size (actual size in the phar)
* @var array
*/
private static $_manifest = array();
/**
* Absolute offset of internal files within the .phar, indexed by absolute
* path to the .phar
*
* @var array
*/
private static $_fileStart = array();
/**
* file name of the phar
*
* @var string
*/
private $_basename;
/**
* Allows loading an external Phar archive without include()ing it
*
* @param string $file
* @throws Exception
*/
public static final function loadPhar($file)
{
$file = realpath($file);
if ($file) {
$fp = fopen($file, 'rb');
$buffer = '';
while (!$found && !feof($fp)) {
$buffer .= fread($fp, 8192);
// don't break phars
if ($pos = strpos($buffer, '__HALT_COMPI' . 'LER();')) {
fclose($fp);
return self::_mapPhar($file, $pos);
}
}
fclose($fp);
}
}
/**
* Map a full real file path to an alias used to refer to the .phar
*
* This function can only be called from the initialization of the .phar itself.
* Any attempt to call from outside the .phar or to re-alias the .phar will fail
* as a security measure.
* @param string $file full realpath() filepath, like /path/to/go-pear.phar
* @param string $alias alias used in opening a file within the phar
* like phar://go-pear.phar/file
* @param bool $compressed determines whether to attempt zlib uncompression
* on accessing internal files
* @param int $dataoffset the value of __COMPILER_HALT_OFFSET__
*/
public static final function mapPhar($file, $dataoffset)
{
try {
// this ensures that this is safe
if (!in_array($file, get_included_files())) {
die('SECURITY ERROR: PHP_Archive::mapPhar can only be called from within ' .
'the phar that initiates it');
}
self::_mapPhar($file, $dataoffset);
} catch (Exception $e) {
die($e->getMessage());
}
}
/**
* Sub-function, allows recovery from errors
*
* @param unknown_type $file
* @param unknown_type $dataoffset
*/
private static function _mapPhar($file, $dataoffset)
{
$file = realpath($file);
if (isset(self::$_manifest[$file])) {
return;
}
if (!is_array(self::$_pharMapping)) {
self::$_pharMapping = array();
}
$fp = fopen($file, 'rb');
// seek to __HALT_COMPILER_OFFSET__
fseek($fp, $dataoffset);
$manifest_length = unpack('Vlen', fread($fp, 4));
$manifest = '';
$last = '1';
while (strlen($last) && strlen($manifest) < $manifest_length['len']) {
$read = 8192;
if ($manifest_length['len'] - strlen($manifest) < 8192) {
$read = $manifest_length['len'] - strlen($manifest);
}
$last = fread($fp, $read);
$manifest .= $last;
}
if (strlen($manifest) < $manifest_length['len']) {
throw new Exception('ERROR: manifest length read was "' .
strlen($manifest) .'" should be "' .
$manifest_length['len'] . '"');
}
$info = self::_unserializeManifest($manifest);
if ($info['alias']) {
$alias = $info['alias'];
$explicit = true;
} else {
$alias = $file;
$explicit = false;
}
self::$_manifest[$file] = $info['manifest'];
$compressed = $info['compressed'];
self::$_fileStart[$file] = ftell($fp);
fclose($fp);
if ($compressed & 0x00001000) {
if (!function_exists('gzinflate')) {
throw new Exception('Error: zlib extension is not enabled - gzinflate() function needed' .
' for compressed .phars');
}
}
if ($compressed & 0x00002000) {
if (!function_exists('bzdecompress')) {
throw new Exception('Error: bzip2 extension is not enabled - bzdecompress() function needed' .
' for compressed .phars');
}
}
if (isset(self::$_pharMapping[$alias])) {
throw new Exception('ERROR: PHP_Archive::mapPhar has already been called for alias "' .
$alias . '" cannot re-alias to "' . $file . '"');
}
self::$_pharMapping[$alias] = array($file, $compressed, $dataoffset, $explicit,
$info['metadata']);
self::$_pharFiles[$file] = $alias;
}
/**
* extract the manifest into an internal array
*
* @param string $manifest
* @return false|array
*/
private static function _unserializeManifest($manifest)
{
// retrieve the number of files in the manifest
$info = unpack('V', substr($manifest, 0, 4));
$apiver = substr($manifest, 4, 2);
$apiver = bin2hex($apiver);
$apiver_dots = hexdec($apiver[0]) . '.' . hexdec($apiver[1]) . '.' . hexdec($apiver[2]);
$majorcompat = hexdec($apiver[0]);
$calcapi = explode('.', '1.0.0');
if ($calcapi[0] != $majorcompat) {
throw new Exception('Phar is incompatible API version ' . $apiver_dots . ', but ' .
'PHP_Archive is API version 1.0.0');
}
if ($calcapi[0] === '0') {
if ('1.0.0' != $apiver_dots) {
throw new Exception('Phar is API version ' . $apiver_dots .
', but PHP_Archive is API version 1.0.0', E_USER_ERROR);
}
}
$flags = unpack('V', substr($manifest, 6, 4));
$ret = array('compressed' => $flags & 0x00003000);
// signature is not verified by default in PHP_Archive, phar is better
$ret['hassignature'] = $flags & 0x00010000;
$aliaslen = unpack('V', substr($manifest, 10, 4));
if ($aliaslen) {
$ret['alias'] = substr($manifest, 14, $aliaslen[1]);
} else {
$ret['alias'] = false;
}
$manifest = substr($manifest, 14 + $aliaslen[1]);
$metadatalen = unpack('V', substr($manifest, 0, 4));
if ($metadatalen[1]) {
$ret['metadata'] = unserialize(substr($manifest, 4, $metadatalen[1]));
$manifest = substr($manifest, 4 + $metadatalen[1]);
} else {
$ret['metadata'] = null;
$manifest = substr($manifest, 4);
}
$offset = 0;
$start = 0;
for ($i = 0; $i < $info[1]; $i++) {
// length of the file name
$len = unpack('V', substr($manifest, $start, 4));
$start += 4;
// file name
$savepath = substr($manifest, $start, $len[1]);
$start += $len[1];
// retrieve manifest data:
// 0 = uncompressed file size
// 1 = timestamp of when file was added to phar
// 2 = compressed filesize
// 3 = crc32
// 4 = flags
// 5 = metadata length
$ret['manifest'][$savepath] = array_values(unpack('Va/Vb/Vc/Vd/Ve/Vf', substr($manifest, $start, 24)));
$ret['manifest'][$savepath][3] = sprintf('%u', $ret['manifest'][$savepath][3]);
if ($ret['manifest'][$savepath][5]) {
$ret['manifest'][$savepath][6] = unserialize(substr($manifest, $start + 24,
$ret['manifest'][$savepath][5]));
} else {
$ret['manifest'][$savepath][6] = null;
}
$ret['manifest'][$savepath][7] = $offset;
$offset += $ret['manifest'][$savepath][2];
$start += 24 + $ret['manifest'][$savepath][5];
}
return $ret;
}
/**
* @param string
*/
private static function processFile($path)
{
if ($path == '.') {
return '';
}
$std = str_replace("\\", "/", $path);
while ($std != ($std = ereg_replace("[^\/:?]+/\.\./", "", $std))) ;
$std = str_replace("/./", "", $std);
if (strlen($std) > 1 && $std[0] == '/') {
$std = substr($std, 1);
}
if (strncmp($std, "./", 2) == 0) {
return substr($std, 2);
} else {
return $std;
}
}
/**
* Seek in the master archive to a matching file or directory
* @param string
*/
protected function selectFile($path, $allowdirs = true)
{
$std = self::processFile($path);
if (isset(self::$_manifest[$this->_archiveName][$path])) {
$this->_setCurrentFile($path);
return true;
}
if (!$allowdirs) {
return 'Error: "' . $path . '" is not a file in phar "' . $this->_basename . '"';
}
foreach (self::$_manifest[$this->_archiveName] as $file => $info) {
if (empty($std) ||
//$std is a directory
strncmp($std.'/', $path, strlen($std)+1) == 0) {
$this->currentFilename = $this->internalFileLength = $this->currentStat = null;
return true;
}
}
return 'Error: "' . $path . '" not found in phar "' . $this->_basename . '"';
}
private function _setCurrentFile($path)
{
$this->currentStat = array(
2 => 0100444, // file mode, readable by all, writeable by none
4 => 0, // uid
5 => 0, // gid
7 => self::$_manifest[$this->_archiveName][$path][0], // size
9 => self::$_manifest[$this->_archiveName][$path][1], // creation time
);
$this->currentFilename = $path;
$this->internalFileLength = self::$_manifest[$this->_archiveName][$path][2];
// seek to offset of file header within the .phar
if (is_resource(@$this->fp)) {
fseek($this->fp, self::$_fileStart[$this->_archiveName] + self::$_manifest[$this->_archiveName][$path][7]);
}
}
/**
* Seek to a file within the master archive, and extract its contents
* @param string
* @return array|string an array containing an error message string is returned
* upon error, otherwise the file contents are returned
*/
public function extractFile($path)
{
$this->fp = @fopen($this->_archiveName, "rb");
if (!$this->fp) {
return array('Error: cannot open phar "' . $this->_archiveName . '"');
}
if (($e = $this->selectFile($path, false)) === true) {
$data = '';
$count = $this->internalFileLength;
while ($count) {
if ($count < 8192) {
$data .= @fread($this->fp, $count);
$count = 0;
} else {
$count -= 8192;
$data .= @fread($this->fp, 8192);
}
}
@fclose($this->fp);
if (self::$_manifest[$this->_archiveName][$path][4] & self::GZ) {
$data = gzinflate($data);
} elseif (self::$_manifest[$this->_archiveName][$path][4] & self::BZ2) {
$data = bzdecompress($data);
}
if (!isset(self::$_manifest[$this->_archiveName][$path]['ok'])) {
if (strlen($data) != $this->currentStat[7]) {
return array("Not valid internal .phar file (size error {$size} != " .
$this->currentStat[7] . ")");
}
if (self::$_manifest[$this->_archiveName][$path][3] != sprintf("%u", crc32($data))) {
return array("Not valid internal .phar file (checksum error)");
}
self::$_manifest[$this->_archiveName][$path]['ok'] = true;
}
return $data;
} else {
@fclose($this->fp);
return array($e);
}
}
/**
* Parse urls like phar:///fullpath/to/my.phar/file.txt
*
* @param string $file
* @return false|array
*/
static protected function parseUrl($file)
{
if (substr($file, 0, 7) != 'phar://') {
return false;
}
$file = substr($file, 7);
$ret = array('scheme' => 'phar');
$pos_p = strpos($file, '.phar.php');
$pos_z = strpos($file, '.phar.gz');
$pos_b = strpos($file, '.phar.bz2');
if ($pos_p) {
if ($pos_z) {
return false;
}
$ret['host'] = substr($file, 0, $pos_p + strlen('.phar.php'));
$ret['path'] = substr($file, strlen($ret['host']));
} elseif ($pos_z) {
$ret['host'] = substr($file, 0, $pos_z + strlen('.phar.gz'));
$ret['path'] = substr($file, strlen($ret['host']));
} elseif ($pos_b) {
$ret['host'] = substr($file, 0, $pos_z + strlen('.phar.bz2'));
$ret['path'] = substr($file, strlen($ret['host']));
} elseif (($pos_p = strpos($file, ".phar")) !== false) {
$ret['host'] = substr($file, 0, $pos_p + strlen('.phar'));
$ret['path'] = substr($file, strlen($ret['host']));
} else {
return false;
}
if (!$ret['path']) {
$ret['path'] = '/';
}
return $ret;
}
/**
* Locate the .phar archive in the include_path and detect the file to open within
* the archive.
*
* Possible parameters are phar://pharname.phar/filename_within_phar.ext
* @param string a file within the archive
* @return string the filename within the .phar to retrieve
*/
public function initializeStream($file)
{
$info = @parse_url($file);
if (!$info) {
$info = self::parseUrl($file);
}
if (!$info) {
return false;
}
if (!isset($info['host'])) {
// malformed internal file
return false;
}
if (!isset(self::$_pharFiles[$info['host']]) &&
!isset(self::$_pharMapping[$info['host']])) {
try {
self::loadPhar($info['host']);
// use alias from here out
$info['host'] = self::$_pharFiles[$info['host']];
} catch (Exception $e) {
return false;
}
}
if (!isset($info['path'])) {
return false;
} elseif (strlen($info['path']) > 1) {
$info['path'] = substr($info['path'], 1);
}
if (isset(self::$_pharMapping[$info['host']])) {
$this->_basename = $info['host'];
$this->_archiveName = self::$_pharMapping[$info['host']][0];
$this->_compressed = self::$_pharMapping[$info['host']][1];
} elseif (isset(self::$_pharFiles[$info['host']])) {
$this->_archiveName = $info['host'];
$this->_basename = self::$_pharFiles[$info['host']];
$this->_compressed = self::$_pharMapping[$this->_basename][1];
}
$file = $info['path'];
return $file;
}
/**
* Open the requested file - PHP streams API
*
* @param string $file String provided by the Stream wrapper
* @access private
*/
public function stream_open($file)
{
return $this->_streamOpen($file);
}
/**
* @param string filename to opne, or directory name
* @param bool if true, a directory will be matched, otherwise only files
* will be matched
* @uses trigger_error()
* @return bool success of opening
* @access private
*/
private function _streamOpen($file, $searchForDir = false)
{
$path = $this->initializeStream($file);
if (!$path) {
trigger_error('Error: Unknown phar in "' . $file . '"', E_USER_ERROR);
}
if (is_array($this->file = $this->extractFile($path))) {
trigger_error($this->file[0], E_USER_ERROR);
return false;
}
if ($path != $this->currentFilename) {
if (!$searchForDir) {
trigger_error("Cannot open '$file', is a directory", E_USER_ERROR);
return false;
} else {
$this->file = '';
return true;
}
}
if (!is_null($this->file) && $this->file !== false) {
return true;
} else {
return false;
}
}
/**
* Read the data - PHP streams API
*
* @param int
* @access private
*/
public function stream_read($count)
{
$ret = substr($this->file, $this->position, $count);
$this->position += strlen($ret);
return $ret;
}
/**
* Whether we've hit the end of the file - PHP streams API
* @access private
*/
function stream_eof()
{
return $this->position >= $this->currentStat[7];
}
/**
* For seeking the stream - PHP streams API
* @param int
* @param SEEK_SET|SEEK_CUR|SEEK_END
* @access private
*/
public function stream_seek($pos, $whence)
{
switch ($whence) {
case SEEK_SET:
if ($pos < 0) {
return false;
}
$this->position = $pos;
break;
case SEEK_CUR:
if ($pos + $this->currentStat[7] < 0) {
return false;
}
$this->position += $pos;
break;
case SEEK_END:
if ($pos + $this->currentStat[7] < 0) {
return false;
}
$this->position = $pos + $this->currentStat[7];
default:
return false;
}
return true;
}
/**
* The current position in the stream - PHP streams API
* @access private
*/
public function stream_tell()
{
return $this->position;
}
/**
* The result of an fstat call, returns mod time from creation, and file size -
* PHP streams API
* @uses _stream_stat()
* @access private
*/
public function stream_stat()
{
return $this->_stream_stat();
}
/**
* Retrieve statistics on a file or directory within the .phar
* @param string file/directory to stat
* @access private
*/
public function _stream_stat($file = null)
{
$std = $file ? self::processFile($file) : $this->currentFilename;
if ($file) {
if (isset(self::$_manifest[$this->_archiveName][$file])) {
$this->_setCurrentFile($file);
$isdir = false;
} else {
$isdir = true;
}
} else {
$isdir = false; // open streams must be files
}
$mode = $isdir ? 0040444 : 0100444;
// 040000 = dir, 010000 = file
// everything is readable, nothing is writeable
return array(
0, 0, $mode, 0, 0, 0, 0, 0, 0, 0, 0, 0, // non-associative indices
'dev' => 0, 'ino' => 0,
'mode' => $mode,
'nlink' => 0, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'blksize' => 0, 'blocks' => 0,
'size' => $this->currentStat[7],
'atime' => $this->currentStat[9],
'mtime' => $this->currentStat[9],
'ctime' => $this->currentStat[9],
);
}
/**
* Stat a closed file or directory - PHP streams API
* @param string
* @param int
* @access private
*/
public function url_stat($url, $flags)
{
$path = $this->initializeStream($url);
return $this->_stream_stat($path);
}
/**
* Open a directory in the .phar for reading - PHP streams API
* @param string directory name
* @access private
*/
public function dir_opendir($path)
{
$info = @parse_url($path);
if (!$info) {
$info = self::parseUrl($path);
if (!$info) {
trigger_error('Error: "' . $path . '" is a file, and cannot be opened with opendir',
E_USER_ERROR);
return false;
}
}
$path = !empty($info['path']) ?
$info['host'] . $info['path'] : $info['host'] . '/';
$path = $this->initializeStream('phar://' . $path);
if (isset(self::$_manifest[$this->_archiveName][$path])) {
trigger_error('Error: "' . $path . '" is a file, and cannot be opened with opendir',
E_USER_ERROR);
return false;
}
if ($path == false) {
trigger_error('Error: Unknown phar in "' . $file . '"', E_USER_ERROR);
return false;
}
$this->fp = @fopen($this->_archiveName, "rb");
if (!$this->fp) {
trigger_error('Error: cannot open phar "' . $this->_archiveName . '"');
return false;
}
$this->_dirFiles = array();
foreach (self::$_manifest[$this->_archiveName] as $file => $info) {
if ($path == '/') {
if (strpos($file, '/')) {
$a = explode('/', $file);
$this->_dirFiles[array_shift($a)] = true;
} else {
$this->_dirFiles[$file] = true;
}
} elseif (strpos($file, $path) === 0) {
$fname = substr($file, strlen($path) + 1);
if (strpos($fname, '/')) {
$a = explode('/', $fname);
$this->_dirFiles[array_shift($a)] = true;
} elseif (strlen($file) != strlen($path)) {
// if the two match exactly, the path searched for was
// not a directory, but was a file.
$this->_dirFiles[$fname] = true;
}
}
}
@fclose($this->fp);
@uksort($this->_dirFiles, 'strnatcmp');
return true;
}
/**
* Read the next directory entry - PHP streams API
* @access private
*/
public function dir_readdir()
{
$ret = key($this->_dirFiles);
@next($this->_dirFiles);
if (!$ret) {
return false;
}
return $ret;
}
/**
* Close a directory handle opened with opendir() - PHP streams API
* @access private
*/
public function dir_closedir()
{
$this->_dirFiles = array();
reset($this->_dirFiles);
return true;
}
/**
* Rewind to the first directory entry - PHP streams API
* @access private
*/
public function dir_rewinddir()
{
reset($this->_dirFiles);
return true;
}
/**
* API version of this class
* @return string
*/
public final function APIVersion()
{
return '1.0.0';
}
/**
* Retrieve Phar-specific metadata for a Phar archive
*
* @param string $phar full path to Phar archive, or alias
* @return null|mixed The value that was serialized for the Phar
* archive's metadata
* @throws Exception
*/
public static function getPharMetadata($phar)
{
if (isset(self::$_pharFiles[$phar])) {
$phar = self::$_pharFiles[$phar];
}
if (!isset(self::$_pharMapping[$phar])) {
throw new Exception('Unknown Phar archive: "' . $phar . '"');
}
return self::$_pharMapping[$phar][4];
}
/**
* Retrieve File-specific metadata for a Phar archive file
*
* @param string $phar full path to Phar archive, or alias
* @param string $file relative path to file within Phar archive
* @return null|mixed The value that was serialized for the Phar
* archive's metadata
* @throws Exception
*/
public static function getFileMetadata($phar, $file)
{
if (!isset(self::$_pharFiles[$phar])) {
if (!isset(self::$_pharMapping[$phar])) {
throw new Exception('Unknown Phar archive: "' . $phar . '"');
}
$phar = self::$_pharMapping[$phar][0];
}
if (!isset(self::$_manifest[$phar])) {
throw new Exception('Unknown Phar: "' . $phar . '"');
}
$file = self::processFile($file);
if (!isset(self::$_manifest[$phar][$file])) {
throw new Exception('Unknown file "' . $file . '" within Phar "'. $phar . '"');
}
return self::$_manifest[$phar][$file][6];
}
}
?><?php
}
if (!in_array('phar', stream_get_wrappers())) {
stream_wrapper_register('phar', 'PHP_Archive');
}
if (!class_exists('Phar',0)) {
include 'phar://'.__FILE__.'/phar.inc';
}
?><?php
/** @file phar.php
* @ingroup Phar
* @brief class CLICommand
* @author Marcus Boerger
* @date 2007 - 2007
*
* Phar Command
*/
if (!extension_loaded('phar'))
{
if (!class_exists('PHP_Archive', 0))
{
echo "Neither Extension Phar nor class PHP_Archive are available.\n";
exit(1);
}
if (!in_array('phar', stream_get_wrappers()))
{
stream_wrapper_register('phar', 'PHP_Archive');
}
if (!class_exists('Phar',0)) {
require 'phar://'.__FILE__.'/phar.inc';
}
}
foreach(array("SPL", "Reflection") as $ext)
{
if (!extension_loaded($ext))
{
echo "$argv[0] requires PHP extension $ext.\n";
exit(1);
}
}
function command_include($file)
{
$file = 'phar://' . __FILE__ . '/' . $file;
if (file_exists($file)) {
include($file);
}
}
function command_autoload($classname)
{
command_include(strtolower($classname) . '.inc');
}
Phar::mapPhar();
spl_autoload_register('command_autoload');
new PharCommand($argc, $argv);
__HALT_COMPILER(); ?>
6 pharcommandclicommand.inc?,gGG¤
-åzF¶directorygraphiterator.incôgGGuôÎr†¶directorytreeiterator.inc%gGG]†p‹¶invertedregexiterator.incÖgGGÕICÖC¶pharcommand.inc9«gGG!cÔ:ȶphar.incgGG)ìk<¶ÅkoÛFò»ÅZЕT,É–] wv¤^.w
$m�¤ŸA ©¥Ä Eê–¤íÀõïÌ>È]î’”{Æ�[wvÞ;¯Õë»ÃÉÉù«WäïQœP&q˜í÷Aº™ÆixBàyœnYVȇ]Àøƒ[Ó ƒ<'oßýüVÀó¥ ,v#ä}ÀÂ2'ÿÈ(ÛR±k”Àëòââ2áoð—1©±œK~Zèòæ6/Xä6È�ã,Í3ä\ ñþ�Ð=M‹ ˆ³´�«;Êr#³é'(Ü–x�'Èý�e␍ º!ÀmÃÇÃ;ëa¸ßädNÆ‚oþȵ§k¹øv0–ùzT¦!ÊGÖkT@Áʰð9Kc)Xq`Á:¾†Å.Î' „”šæâ�\¼³¥(9M¢ëë--¤vrŸ¯�,xÉ|ÿ†m?ã
¼‚�#"ø'¯ÉåHc_b;e,cþà—¬²õ6¾£é˜„;~%ÃGäxy±z";š¾¤��'B“œ"‘Ó8Ïiákò,¹¨ËÙjµôX™z«Q'ýßÒ¯ivŸVLx’ðlõä=ƒ—‰¡B'5è´¦žÈÝ lvHPÛÍI².sÊÖèG¾p-2&ÝhoL¬1 ›5ží�=8»° §¹z¿Ã(ãŸ�ÁÖ×›¬êÞp·Æ+P#™Ï‰7ñ\ 
Î@BÓz×÷\’ï¾#†ºPË5ÝÒ•!␍@V&nZ�‘␍.ÙbÞ.šþ2üê½Ôl,1~‘"#‡€{ZP^† Y¤ù�ütœ×5_N/´Äo(␍á.H¼ªDú R§šë(‰D êàÁ¹òDúXsžG]W�Ê^OªQ©LiìÙ
³íTß-£ÁW“‰Åüf�k®sÏq”ô~ÖŠýO3
øñˆt-iå¾eÞË‚8Ñý9ÿXÂL¹¯‘m›/¥üîÕMa¹Ò¢ÆÙYKÐpcºˆMZ»ƒ™Æ� Q<(c¼Œ␍LæŒ/Q.ît?#A.ÃçbBµù±¸¹/ª␍[¤2GZçO¥wn”÷Z[œA¥¦éœ�Êaµ¸1AöY:zþ1WKnF#¢Û¸Õ¦6Ëh¥ÂŸÈò¢üëN-)I¼9–Õa]~¦|…„>ÜçÛf±Xœ‘ÿéó?ÿõñ# E˜Nl\F� ÀéC\@u»¡XdŒH»ÐŠ ïk¨ñ…;ýz¿I´¢vDê²Êço‡:õéY¼ÕMG™†…ð÷+`+®3Z”,=Æj6®q]¡ŒmöÄj_*éWˆôò³ÃfPÔ*o‚¯¹_·K¼éá=?0ÅUc’—·¹¥ÙÀ“‡ ž¦ôž|¤QB9½·ˆÓ¯°ëÀ 6òl ’zƒQE(6YÏï)ô„зŒx˜Ú×gðÑ>¯%6…àc“E
‘bL.@¦„×—ŠNÏ ®h#*N>Œ,°–¨u¿
­ÉÆ09Sâ"º³YK6¢­HÅ,™ròðæ­=ü‚ø[v*Ò[3zH8j°iŒµøX¬¶Ðä) 4½ r¡iŸs1²…n\áQ !XrŠ«$݈¸8
C_þÇ—»65Ð,Q�ˆìüZEŒ @­×× ×WçBñ2óŸØŸªÚCõ¦Üu›'Ob­:ôê0k'Ø “x␍_ÑôBq¼{�xá?f�Qwd×Zÿe
ØÐ˜Â`ØÃˆÚ ëÛ,KTä#üÿ•~kaÅGàè{i@´I4sz¹�?9•cçâ�Ö$N'Ù—yAn) R˜è–²icìpbɤH*‘Ž’ˆî‡^µ5+»Î«W€ 2ã5|‘�?ÿ¨ÃLf+�G‡,÷½ó±'3¨NNú"²–ìºj\L“ÇaòÎy,EûMñK{}æÄíLÅ¿üöîÝ‘YX78
␍^ç°Ðiœ®e…Á¡ùç5ãI‹¶KOàÂj¥Ó?T54ì%UÓ
¨ÎH–RœZxÐË¿³8õ˜?�´tàYîÛj»#t²‰Y¯B†„rHÔÉ!(v¾,™ u␍£ù|Îý‹üþ;9ʼnùªÌ¼ ¿Ágq.hEÝ
ûÍ
ͱECbJ_›Œæ\ii¯¢£Å�x?‹¹dÆ
ëÓ!ù €~N£ÌoT‹fñ²é#¨çªG[ï×LÛá§á.#š.øD«.Ì#ÅküÙ ê´Ðï"8ŸûbæTSí>m©¡*j*Lu*ð ({ÔÒ­�à?^–4Ù>R3aæJbî<É-Ž‚×N|!“Ó␍|m]lD|Ÿ>\úÃd&"ýç -5ƒ¨UiPøÁÄ�Ìȹ„¿ïáﯽT®$•äò¿%%?&üÔ¯r,°€Ø ~ ÉÁgèíøè�€cðwô�€ˆà gH]ß␍ zЊßáœAð>c›{@÷‹å,òùÁrzìy÷ÁƒÿÃßÈ„}1ºáKççd§ñ¾Ü8@[é¯8QÙÞ]�âVk`1ÑDÝ
xƒ<e•K\ÄA+fhnåûuF÷Aœnð6Ï€×–œ‘1ÁÿSv3A5NëÝD“/©—[‡{¥ZW ;Úá¨_Ïh&î]Ø’‹F¨R6ò#W–ÞÁ@–�øT#Ù˜(GÆä␍ÎaÔU|©1ÂÙ“5û)V§&ÇnÜøÂ§eã¨}"fŠnœòFfÀgu„ ºpQ¾)tÓé´(öR»ö0¢ÒX 8apl·nÏÀ¾Seíeù¡.'¥°ÙZ©È„è°L²ò¢6yÛª²
␍fej¯ôê<Á[à »•­&Bî€Ù¡àȧÖΖY'„±>�+ݪæÕ£m i¤+—‘®„‘§ÃR‚ò•i­+Ћ‹Ûí—h`pqxËå,uð—Éð1ÉŸrx<æDGj„ƒò]qϸr{†­2W[¢ŸGTUWì8:¨Hʽš|¸«¾–¸þ’»( �|™†LÒúõ€aRJƒV7)£×²’4V]IZN#<ôm21_xAúÍóK�ù»;1A�…ŠMuñ}=`c1½£UšŸ6‡g¬LÝœñ©.1f×ú�;îwq¸kL¶ëË,³Ô—Á…oéôk æ�YïÕÕ{8`¤Ø)o�ŸyLŸuUKÄ?,/Vv”<­:ЪUáÀÆíˆóúµë÷ c)è†ùœÜ7Ò…~„ÎéÂø‘pa^åð§«¾Q¿è»¾¤Cy™E^Kæd™qOÌWü”43š�¾æ3~‹Òàºq1ÈeÀp‰­ç}8w)™S© Î¸­™
yZVMjzm ‘�ªJnÛhà÷•gÍß¶)L6-0êCÏ€7w†<4–3C“SDÆ“Úfl÷#ðt$s�mLéNš,®FÃèÜÑéh-�¡™^�<º¬% §U��uq—ɵ8ÄÑË⨿�éH¸�o&­ÔnK´6‡òTÏ,␍ÜØ[d1␍§‚ ­ý(XI[®Aþg<ˆYÈñÕ
¾D CέMXqDtñ¼Æ{�@&hí¾ßaš Á]'Ámý£Ó¼Ñm·æe7ö®*Õç9ÎÚ³BªŠ:ê¨Á9vê ÕªŽ!�-ШOf¦£?�€ ?.Nþ…RÑNÂ0}fÉþá>ø 5¾L#☰8�°½ø´Ôîš`·´�BÔ·ÝØDc°»Ý=çžžÓôz�§¹mÙVïän—l��0�Teb»$O™BAô_—qj[ IŒ¯DVäàmÈK¾FYuŸÃ%Ð5‘FµÂØ(ø;…ŠG
•f`J-$Üe(V¸Ã¢ô:ï÷/àÔ”K”`8t+T„'D$0ŸÌ!`Ï‚ˆ­�{M„C"Ô¡@¥DAÆ×[�iö&›ì e÷¿¯($Ë8œuÏv&åÜ(äÉi/ß·ón[­eÁ©2’qL3.•(¨:>ʉJÛ5ŒÖi¡�}m&ëê8ûC†Úâø␍ß%4Õ·SÓ+FI™�\ý~7žVéªs€á8ÞS< ã{?ðfé·ÓmWµÝ�jóË—ã¸Ã ˆ£Ç0Zø³ñÇpäNâ±ÅîÄF¥H-–—I'ô‚{}î"ŒL»}¥¿Ÿ¶õi^Éàæ �SÛnÚ@}‰˜$ìiÕ'!¡@T'�b^*U²3Ø+Ûš]' &ÿÞYÛ\r­%Öx.gΟ_fQÖ¨7ê'GGpµ�1Â\:¥µ&D©‘?te4êÀ52 )Í3¯Ä2‹Q•ÑI\@ ¥`´˜2À¤(ËD®£”ï)RˆUn.4__z½¯Ð1·o&Q$½—CžÉ\ÐnÀ•3´6é“í‡ÈÁŽØ†èBLÌÂÀN&’È"ìT#ƒú7ý'$%ÓN»§§j®4&s�äÜ÷´ÍìôúÓ¨×ÌRÃ4Qšò@ÂÒ%È„Žºœ4S3Ab MÚ§œBùâ°(c.µEžÚðóý`h}6gͬca¢g¿ÂÄk >ïˆE±ÌžeÅÛ’:—ƒÚ*çÇø—?ðüë‰;¾Ü�KX»␍åŸwSg8p]úÓ›>Nîo^>IO‡·þÍxêo'î¨Ù€möôÆî5Ï{ô¦&lŸñùjœT¨~E¨sJ@GLÚtƸ4÷Œp!W8‡gɲ¿ñ�*¯í+^µ[[¡›ÆRp­–™Y[°¬f|Ñ;ƒf çÐÔ‘T�~ˆz„™Ž,ÛÄ��m(š«îîÅ^�—ÏvRÇv§ uϳl¸„Ö ´Àá”ã^ÍQmWañøÿÅêX¿;-»Ê«{ˆŒïëÔÓÄïÇz'ò C¶©*t– Š ·_À%Ù™"Ž­¦ ´�ëÙüj+kµ“)ñs…ä›2_‰µUžŸ“d_ˆö²¢Y0½ìÿ…PÍj1>o ï0ÞªPÝzVÑÒ›¡ô␍bvv7 É2™A|w“u[ZÅu.óý&«MÛ´RH1›Là½2c¿‘KÂ�†‘;š«¥€È1¶&Zøl]/{2X�>(ïaÛ‹¿’xÛ‹¯4¸q°S¤ƒ‡‡Tc�•ŠâÌó|¯ÝJ@þXÂ�çì·ø£R0 nUÞ8 oÓ¼�x à‘Ñ–þ6ä$EÖõ#ä@Fÿð¢PZcË/ãH‹Y\U°šSî(¹dO–‘s–âœ~d³¾í=ýwÛ6’¿ç¯@²Þ¥Ôʲ�½Þ½Kj·Nê¤y/Ióâôú¶NÖGQ�Ä3EjI*¶ÛÍÿ~3ƒ‚ @R’“ݽw~¯�$ƒÁ`¾03¿ýnµXÝ»wðÕW÷ØWìûYœp¶Z„y”-—a:ÇiDâtžgë{Ïè‡Ió‹’°(ØÓ—/žŠöô(\—‹,gì€YìIÆó9½¦aÉü=<<ü¶OÿÀïø³
ÊÁ½ƒöûï¿Ëð©|ÈøMÉÓimT‰¾ÙŠúá�øß»E\HH x˜ð‚• .>ÃÌX6£ï+999ùbÌ^”ì:N6ál]ð)›åÙR=fЕDYZd Çnqʲ|ÊsVf,ç%è#gc­KŸÍÖiTÆÐk¬°ó— ¢Èô°ñr•ð%OËÁtQü#Ï hƎƇDÖ^ôüý.’\�Õz’Ä‘Æè_Îyyyþæ!5ky>ØKŽFl/Ìç—q:Rsÿ€Fë<eE™_æ|ÅÃr°š'Gìköþû7øï?‡�©Ã'…Ò§OŸúa÷gÑ Yÿ¾bO“˜=ç%S�˜~òý*ÌÃ%b‚Ü€ÐßY+˜ú=�Þ]óä#÷4’3gúq5g|ŒÉ™˜;0—øq,Ûп®yIª&w%­üŒS�O„.�ß B#3_Âð…MfbZx°F-Ô¯ê_ÅjV°qœ,!S"¨åϽJš¸×‹8Zà£_胒¡¬/²‚§c_O¥¼]q¢?}␍€?ŽX±âQ<É¢*I¾Îò+–¥ö
®Ó«4»Nk‹å%Ñ@à:ªF¶lO·eÇ0“<¼ègø„;>q=¡§’ža‡E0j¶ø&ÔâõÏ/_: ß„Ð=yö1ž¢côKÃ%g3P3z��Dã lX‡Lz¢�Þî„ô$Lç€3û1,ûø…”3.¬I^Ê ¤’|<³?Ü?XùÁ$NÀÇÄ èÏ‚ÆHúoè�Ëø". žÌØûà÷ߤëq¤”_Óð)ŒJŽâ,¶B¦“ŠEý(2²
“ùŽK=Ï�j öW9/ÈNàoy\.–ch˜-�Ê6 ©Ù!‘ Çx�¡4+è�Ô>ÍRlÐì]&ڟ§%J(�[&Ð3!Tói®ê°ux¿u…“ïÆ»–á5Êè!únh6X® Ðji”¬Aßüxú¾W/±iœÃŒ3è@âÏ€ o‡,6ë55­«v™ªd±s¡V¥ã¥µ‡1Íœý–C2è.(/98SÓvN ”§zA³RÚO6‚åôóÕߣ X„Gâûù�§GA;ûÅýæ›ó9¿ÙiºáÄ\¡܇ù:�%â7ZŽPñÇéj]Òº«uõeÔ~œNîëIå1)XF?ÖkÔŠkÒW¹6\[EG2A_/'`ÐÛ¹å|ŠîH±ž(1&ÉÈOY‰ÍI ªxÔ1‘å—!:ÈGˆ"ý
þe°¡ Ƙ¸k�©¿Ïcp~Çì+5ìÒK«~H²vY;ÍA€8a/³ˆvQ¸"o~|syŠ>¸b—D´€ûœƒ;Q”ûÄùf;{Bµ¿qð—lÍ"ðŸ`ë.Â!x Dïƒ#ø$KplPÙ% kFl] S ÖAo�
Cª␍;8Ã<•0ĘIí§L ÍJÆópÉ@œ¯±=¶ià Ì!À–XÌ`:N}«�nxRd,œÂ†²È–82ú�°½•¾Që(E¹ž@7h–jço¬
ì
ÔM°<ª€SŠ–äìP@b8xø×y¸Z�€µŽF2á+Š0¿³S@l§DúÒ˜íûa„µŽ‹`@DfëhFWá\„�áp©aÝyZ¬sn6pÂzV»�ŸÚ…¿è';8‘�$—ˆ ºpµ�8´j=ö7_Ú¤½í4c´7äX5‘×ßag¬?ó (b‚à.I�LÁoI< †CcC‡Õ¦îÜúÊE€Oóß‚Øä˜Ï]o:½�û‰W¦ȧ.ä'¿=ÜwlÿAàþ†}¸ò@át@1°ßC/ì2üÆ ôBÉyôTÂùzµÊrÐCçñ<␍as΋ÁðqmÎqz)]2ð¼ö~óï © µN~QGœ8ìOx0üì%u}Øoްíhoˆ ‚T˜àg7ÙjQ“—Ax-FðTê^rÅoiÍæ␍|ÖøPp.èÜ2[£¾PŸ¡µö9ÿÛ:F=MMW™A(Cvÿø˜ÍÀ^p«£Ú);:&vÇZO$z5ìßÿ^�²ç¡ sA ‘ˆ8ÝÇ­�.›¨®Gª÷út¯ùI�Øfa6 ÀY:-~ÏÊ´�‹h>fú¹jû62{Pa/vˆ<´ì7>IÁ­í³©XÙ"¼œ¢+&$â›§±€ˆ�ÞQÄ„¯CgËøCé¸~¸b蓤Ai¢w ö3��¤u!Ð
Hý\gx¸xf¶¦€6+x¸cu�zÎ#5#_|•†7ÛïÃ÷„§ÕoÈ€Uå—;ݻ(4un¯ÿ©
xRÓhã]K€?ŸÅ´ú"Š2b�’rOÁ]EËHÑrÃÜ„—:~ÛpÖ, 4
dpJgñ|� ßlð
{ÿ!ÆÎ_R?È\øÁæ¬Ú<ßQÌO�¨}훤 ˆa;¢1m@MC�p}1Þ…ÊF}…½=ûÓŸØ}œÇ%¿wµ ¶Mí>#¿ø˜\šºQº¹X%q9xð>}0bÿݲùï!én˜«SÕÁö"ZðÂ9”šXßù%5<ý6mì}ùáëÁÅ_ñßñW8úÅ{ø;øËOrø1ÆP÷F€$¢0Ò6¦Ü˜ºjyqô¡‰þM€WÍGŸîù¿álîÇEÁË�ljÆÞ²€õbÞ U•³nî7@Œé™›BÜà1,Œ›šsøh€±ãG�Vñb3tL“qÔ“mh/çíßB&�¢\
ÓwPŸ”XÑ0¦” Ko¯ÔÐéio×j¨DZ–žú´‚xÕž¼IØ:W¢ÿÖDMg¨h³Ô[%IBuê$¹œîÕr¨{É÷…oÿ&ñ¿<“–À­½Lî{ðF…t FáêEøQn›õ†ƒcœ
šú€BU}Á]J\@ß`„¢5láJÄi7îÓ«ëe?RÞ¸�zz¶“õV #m&ãFàëý<–e•™à"YœVaràÅlÕ’Ë$6V½£;ÃŽ8Ë—²L …‰Uoübôi8nfú”ð$Æ–i DXì(+bU@ɉæôLÕTˆö ‚Ö<m’€HÇ>Špö ˆK:šFEˆâ�Ÿ¬ÓÀÔäç4œˆ„.§XÛÇ ê|.ºöU1¼Ì
‘½>»‰¸ˆ~ïñV1­ÂŽ*á„ ®©�Î#À‡�Ðþ lS_aœlÎCøé�K"·¾už´Ëq
´ÚO⫆Ø=]pØ’”†‹‡î�ã�ƒBo’zq)SØàæÌh¢`Ñ>AíqÎn©�ßb(óD»ÃRÛ’ºR>B˜Û£b{¬[:f.ª†|`‚nS(AŠ$bÍäàfÍ‘Onß™™·}…õFÒ§Po>9h )ã4%Î/Ê»©t›¥°æ'¬±Õ&Þ„MáuÑ$n6ù „¢}'ŽUµdàG`ˆzã␍ÈŠôÊÆ
Nb£ÐlBòágU(¿„F¡¤S»>9£¼ª€ž‚¦ùf€ J# =¢¥ûˆä—( é¿æÔ«sÑ� irÚ¾G¤Ãr9bËðvÂåà†VÈ]ˆIšyœâzÜ­ó$‹OÚéí¬ÂØHòD¬³Å{!ß§ò{d‰�×Uªyì}�ŽÀåÙšH÷ÚJZmk±ÛœwýA¤®„q±„6
a)B>�œûÕ¾I␍ _Ìdøv­¤l¨ØhÃͰêzèêØøÅŠ*ÜÑî"ZN±ór¥B¤†t¼¨Ž­ªª‡÷NÙ”W5␍áSµØ Ÿ‰mVœÒ6õ�a£º5މàÀc¹¼Ápo},:RƒmÎl’>02Ïû™BŠá¦õ4!æ;'›œ™Ž“µÖ´«€½šU#ow0�óbìêþ.cQŽõ´T¸¨L7å“U¬òÍLÆ
XânÕް_e@¶¿2<‰ »Ñ¡*´)¿ œ»ø…V!¬"¨°%±rÉ(·£R=5ãU�E+ÿd#VQ¸5XE%•„ºª
]ƒp=G`UÜàÖ^†.—²™•€R)®ŠWJãŸ.Z©÷§F”V­(1Ì­tÚ[�¬§”8Ö#éßOSðt½Ž™4¦JŠªbgÌ^ÌØ~Œl‹b⚟^¿ü‹Ñ�œ²²c �ºª¬°NTˆRK+ô␍‚}² ³T�»=À^ÿô®ÐJ¬ë/®Ꟶª—<¼¼Di¿$÷Ãæës^•␍Ô˜Ð.åwÀ ï‰Rí=üs‚²—¡m™Ø¥`ñ‹+t/cà”� #…î±ÞµŠ‘lìˆ ¨$P4b‡#ö�2>Áî;£¾Ô^¦4¡=¹¿U6ÓgÍp¶šœ×‚Ò ÔÑk þ5;rD�«µn€Žê0{lµÜ;Ío/Ú}w
ÄŽ”7º†&C¨†Š/îûùž¶Ã“ú©�GãzÿˆkÓ5ðX4Üž6BÝÙ4¾ÅófbÁÉ«ôX`ä]È;|Ÿ~wâ@ Œ�Ò)Göõ;ç&|j{(8T—sÈ0¶(:#Ddá™,áhõ¾”Ýd—KUЦÁÖiñx7¤-*Ó‡Ý8ªjsÅ_^>{ñòìòr¨B¸`kÜ‚ïN^ºx†Ý|„c�ƒ& �ìà©OÕ´ÀˆXó›[9_%˜A_^[„f'Ù¡Ò3ÚMžN]V“<hõ¬ŸÕ„ÖÝ6³ËBb2»]À␍Ý£øUÏ7ÂZJ�Ðt$§S‘8JG’úŽ:Xr$fÔ“%ú�
þeÂÔ˜C9h×Èwt2‚ò¼óuÚµ+xSE2=Çë(Ï"O“¬êí}@•Á,8gg7¢Vu^�£†åªäd^sr*§Yjí\§0ÍY4ö¢<ŽŽ4
½7�p“Ûfl o|Š›;`”›Ô–§ÀôÊ”M0²CŸ’ZY°½9Åb2Ë…é/y\òÁN©’¿
šTªª�“±C¢ƒw ‹íö°¤xÿDì™B¬ÿí�Q2Qó‰ÌÆWcµ3¶Ï|�™�…«1ß:Ç®Æt.ÂÑ8q6:«ÑxåjLºÒ¹p5ŽÓ�m«ñ�»1î›��¶Ucâ h©ãòŠò¤`Äí`£ðÔâ“õlÆ1T+Ú3Óc»6IN]olŒìzfð½¥g#&×Üc�žÔÐò�$IFríG=5bgfÙ3ëàÐϺ:U«›b§cم܈rNÑtQ�­“ö&ÁUŒÖd�HóŽ;l;ÿÍ
ÚªŸã•#š+yHÅßOrYŠç¿î±£ºJǬkPQ·Ý{Ô'¿¾xó°çÀS> ×Ié…␍ÖłްU“MBଲž¡*Æ>U�~Ùí •´f«š°ªçàv—ƒÃ­ÖOàétZZk¹I»ÂÄå %�ó¢t•l;0TZ.òl=×Äx$ žÎe F§ÏK.U-‡×�Éjc’K|Ô9‘>µS6ê~ê¥.õßô<Ú:jS$ïYÀož‹S<Âo^Ðô³¼ctiÈ‹ô#Ç¢ýZ#èfƒ2ö RsŸë0¸Ì3fÓLHËñË{ŽicÉ*1 Ä$˦Dš)ÓùËBÔ„£?˜ãå%qRçÍj%ÄmWL­ME·hÒA‡ëôõ/_s8�’+hg"ýva»¨ò~ñ™³ZY£ÓùoÌHý«�u:‘{0&SÖþ-�Öy’ñƒbUÅ.
­ÇUûª4³m·4]Dæ¦ÝF¸
ªÁ°I­“[µ°Õ*¶�wÊ…FpŽÔ¬eЖá£Ý§
+O´�/Wå­Ú¨b6U·`¡Á[&oÂr1 µ°~o/Ìmç À� �¯' Oï†#1¼Á(;oP�k”a¬xŸ2Œªº NxI•²0)rÁç©Æ¨QËe»ÂjƒÔj®èìh¨¯h·t–•ñ[�Нv ÔA|“%<õ
F«Ÿ(ôPýÄ7Êú:Ð|t=;<`šU÷“øn2í€(x¨lA-¸q5‹ me>‡)âá´D–V™ð©xIßcu…QF|`üÿ'žÌJÕG1òþ>;a‡h@j�Cd0lɺTCË`ºšÅê룦#[¤gCªîÇFøÈBåV®b´ÈØÑ™§u'óB<ùàNM‘~¬PS[ m¬îjS¡° WY¹#|ú%vž¡ïd{á¬é{ቃK\A[ï�áªÚ¾ª[Â÷VÂ[³�AyÑÔ%ÕTíÍj"ÙŠ ð~вg‹–ä´YgÁ‚º¶,ötµ«SŸÆ`¤(¦Ž†Õîu‡¤×$\{_›îí…Åk8[öLMí)^M–‰±_2g%Êú @*”ÐuYF{ü´IêA;Fó‘ÄÄ:óÛЮjgÔ'F§¼·–ØØÿ1�t/LoYãhrÃ+�ÅSÒ³¢{™¯¹­þ’ä6 ù%®Õ@®˜Sq™Ÿ{c¡ 1Ò[Kd»
ѰvÊ–R¬‰V—?Ò†ì¥jä­Fû£ÿx‘!Ömõ
ìÁ½Ef8(S& ].«Êl‡jª®Ië:Õ–‰WõSIÕ¨»XªmÊ�Z©g±.’ZçIÐ'j˱tÍøí:uNs=f(³©Ýûdxœ“ö‚­—y¡¨j³ñ.çZ½5¯ñ$*†£F)¢Ô{ÔAX›EûÞ­-ØL•X¼Œ;䋽Sm¼âEF̬÷$q¨Œ$Ž"ëø¶+÷D^IÄ;Q}£Ý‘Dv‘IKd7­Nµ`Æ)ûùíK&ªjû×3¶Ñâ3Šh PD�ÙkI•Ë5IÞ–P­Ü<W‹ØjÖ„]‹Úsl«dm#}Ð[-8 ½Z¹«¾º¡†ð—UøGy²½Ð¶õ™þûþ·y–Qé“ZíKû†Â”S~Sâ�¡]åÌhæ‡N1¯£¡D€E£Ý_¡HD½:Eb¨Tˆ:]o␍·ƒFéA©JSÔéeKØuÒtÐG¢®†mìKê5×­@ŒîÝŠÉGSo­µ¡œ¶­°–׮’`yuý±ºo+ËÒkó¯ÞTß½¥ª¶‚tÅ– )|È]8%”Þã÷ÁЬIÞ­ ¹MyÕ®‡=ðQ}-…]¦¨â©'y7•—ÄþÆWwÐ �Ø3©ä>¦\•[Q¶NKñ#åG�g™JعãË€/ͬb’d×|:vœiö–åÉ9Á?‡Ö ®»”*bÐBô)`™`|éX¥kcŒØS9—™„™ðÔ¼«
;©Û ‚îv•ÄGÃæÀ*’(šʆV©ôÞ$á©€K7aãZáG£Ù’BÂî¶QôDÁ„�§9¢+ò •ÑÜÐ?²‡²…ó¬Òa3å[©ñF¶[+q6÷˜r‹iÔÌÕ¡RÊ[RW4Žz¨®S¾‚¤WGÈ«x¾Œ)_ˆŸB¼ &™rßíUÔÏó`F?ë\�qnµt’g~„¹¯Mæ ò“q̱¾qïZ‹�—°5q+E�HðLÉ•éLýì¨V˜%ê²*¡ aš) R±µÀÆtžuL�=Z®vÙ’*Ö”`š×ꩪ§ë<.1qÖÝÿê:P»á >“)“w¢ªôÛÔu«ƒù­öey…éê­•Š2Ž $yà£É÷Q¶IÅ5T �þ+�Ç4­ºÛêÒØU‡ìj'·Í—œr$˜-û?Яt™
%Tè8`X…³Îî¶8ÁÍkPºý[�“Ͻ␍$r5Ì̽r°½cë¦åüÀ·UÞ{u•8œÔÅxuˆÛS55�<PZÖ|×úÝþj;�šÞê™í¬nãÆµ0 ]üG¯ÚilVÁ’ˆWð”´)’��<ouÚÔ•mîvØ<´ÐõŸÝ>ŠÊ:ÖZrG�Ý["*Ÿ¯SŠ‘›I³êa[ÅÚ6²ë¨Sƒ-2&rªL*«K�l1l‘YÇÆuÆ©0¯·c•’o{ŠõòRuVp–»Ô]¶¥žº=YÎZoÅé–1×$ügo£gqâÜöÛ âßÿ¶ý<‡m�ÅØv?[S8­ŒfÉ—ÚÈ›XQé¡«lTKw±M·ús²©*?°tZäÒ~ªn§�¦Ü$y©Ê{úœ/è‘è4ÚŠšÔ¾gZKú?s␍¾Ugù�­»÷#S BýÓ�Yû˜␍ÕîƒÍ´åÉ8¨¾2"?f}U‹ï2ÀàHeÊú ”‰“ׂ™§è�ì)!‡þyózPnif¨VÔsòmgâ]
Št^Q‚z¨®éÀWvEßdЈuX;³Æ•ÊÚ×Zν¨j"ÒߤNž­ŠƒZ�&WÁ­ñ‚ÝÕ}]Ãúhh¼¡�f;›Œ—l�ö¢œ9|“r;Óå™}ôüFG¸ú«ZïtvªJÛ mÖ^+ƒysíŸó²–Ò!‚Ñ51ú)tù׆&±Õ\O}5oÑWÏ»ô•OaÁ>µŸÆÂ␍íݪ¬’÷QYf|®ž%’—ÊÂ_Ñ�Ò&f¤‰þ‰4˜ƒ¤vü¼¢(3É^‘OðzF§’ùRÝQe’Q/…Š”ª®4[)Vúb3}ˆ«àŽöÎLÔs6õ›nIáMëBš‘‘Ô*}=£œ²¶ÂôóS³�y)«ÑN—«;ЭtÚ’®î¯‰ÔÀ^M¤°Ç“SÕ‰Bz­Øë ÇBÝøG”]TIÔMÔÓ|nÕ­LšÉæ¨Þ­[tѧ©>žò»Üõa.ŒÄêF’ê�ïçˆÍ}�Ó½F¬8á½ÖgãŠýöë79UÜyßb5ÍMOÜÉü½Ç¶!�X*xO%ì0ÑŸµZãÓmgÙï°uÏ‹5·òzãyã€A£tYŸ×Þ´ªoߪ|»ÖÍy½þòØ�¼Ò’è2ÊsÕÐgHNkFĦb/´eúM òã]�®É“ïèc²ÍSþîë|»°ð˜’ÞW©´\£RÙçJ‚mD _áÚL@G�^ñzÞ &´ Wo RH´JÑR¿d¶Ú3
k\Õ'«âBqõ¬ñÞYŠum␍C¡¨†öÇÄ\�Õ[_éE¨ä-ÆüŒ#Jˆ7Ë›r¯Æ@jyCm(Ò44� ùïÈ] ç6>yÓ-Jµz=0ÓZ¿”Cä2Ę} ;¥;<wÞÖ0ÀÊù~R¤:¸–7I‰aÕë<DõŒÈ£ p°J m6K€s}g°dñ+ô8³S$«¢�±°4]^ÁÿE)¹ey(N¾â(ŠŠivQÏ}ÄJ«èÙòV—[V¾nUÝ%gMuͯ^Ý…Â^bL¬{¿�„ð,�©�N%Ë␍ÀÈôVõ^ÂÝåÎA·jµ¼rµ$°[.·O=éCuSljº^^(‚®{¡`¡ÔŠøïYØË’©ªË¬ºÎ«ÅÜÜyõ»N�k¿xAé m1‘/:�æM¬F"@uÖ±¯ …\SÂâ}¡2Ʊ“/¸+Ö˜ànqbp!‹^˜Šœ[ï ˜ù˜Zvä%US¬o‘Úz@¿u_è×ÊÀÍí“^¼x'^␍Ô‚Ö6õ7NTWLU9róÍü8é=,EOOéJ§ו 55B„=ܼ85}<¬Û;Ý€Žô�ÛÅk&Äm)ÿj^ž¾bRŒ¯ª6chW(LmÿYºqtð¡âÑ_ò©È–‰÷ÌTôLBùx-.Ý®WÿC;ÅÅ[ùZЯv¦‹é]ÎÖùZ�„PΖƒîàªáC]ìÝØFÝåhÕ,ßfŽ–3¥õq´ú›q(pCÇGÈâ댩fÎ{²©ªÅ¾I¿nü �a [¼¨.VMäKN@ÿV·ÉwD‡·ên`5B”ƒâuîh¾µ¦ÍÙênêðõ£¦†ï|¹B?§ÖæËI©CÚ>nKÒ<å�·;º|ÕlsŸzêá7sI §×%‘uý›{%>7+J¯¬ŠRÛöûì¼ 2þÎ¨Ž¨B—>‹ —"ƒ�©Ž�xÙÜi–Y†žÁuŒ÷e–wc¨ÝLñ”YPɪĿtY㦞†º…>«¡î�e¨hJ‡e�P»Av5èi�]ÄùW0ȽôÿÆVÿz*`š”iÚ¼¡�F7` ïËl*î¤␍:06]ÐÈ@yC¦í?©ô-Ðoü$‘Ôìc³ã[gÇk™3 X�sÙw �5Þ,d^˜éñj6à†Ý¹ �␍6XþS{ùÿþN|ã…ÞÚ/A{Þк/ë>É Õf£÷2–ò�¡*VÚ �ŒÝZ$¦"Fëçx<¹­’$Â~¯²¢ˆå%±Ê˜2l’ÈPÂ.öÝI\«ÂéEç ›fÝ$kÿ]xU›†ýNìzЦ»¸K(Ök»m´sŽØçþVW¾ÿÃÔb:']»@�J�ÍàuÍpW½Oñ­M+ú_ô˜êQ]¼»Âûî{ý%ÄáÙ>�q£*××?½>3Ê[ÝQ]gWå"Àÿ_Š{{Ù̶æeƒQ»1†ô=4h¹vþJ7u4•?[œ¿.�¿Ê—ëµ žÿŸà+�žüú?™‹©õ¹i‚Ž�47_²ˆh|ýu�|Ä&Ðzÿ$.žLÎãG‘„AÒ¯�™67K¿Îqïë0iî±±¼Í›ô‘T»@j}p!R½¹ YV�uÇpCïgk%#ô$”‹<-H>í‚àYåNK²«�»û•,RöÎĹ^?ãïXrœ­­.³VnŸ
€…à®=íŸ6[ ðÝíç¿)¤Ž-æi톒݈-:¦ƒkƒ]�å:µ£‹aÚ›ƒ1Ú§l €^¬À7*gƒà�ã?ÏÿøG¼ GðÅw°Ò‚ǾbG‡‡Cv ž<¢ïÍ?ìÏ“lBǘazj ƒ0[T«C–žõÁªycîj}Ô-<Íêz×nÔ�¼¯[àhm¡ÆÚí"oùßÖ¼ÀàŒˆÈÔ“/®ë•ꮼˆYÖ­·o+],%u3aœ EC�ªýzG ºðl(yì¿ oŠ˜Ô_’�´¼é@b¶¢É˜�ð®yq<ËAÀ�#¼o‰í³:2øÞ)_`£Us?Ý“¾;¹÷¿�’AOƒ@…Ï쯘£6±T/4ÖÚ‹š4ö˜) °qYÈì.jˆÿÝ�jj iË…ÌûÞ¼}K¸Ÿ×E­T<™(˜Àc¦␍A] OµMzEÛœ«PÃZÄ^ز¦ ƒÎíE ¾¨`…œOqN;”¢'�çf6»…«þ%z‡ºmXVe‰6•9Vq mÛþËúôdSž×o N
ÝÐ_מ÷Ön:Öv^]Ö†J²½®ì©Ú␍±\Og}·ã¥öá^) ²ÛЋ'F_±jU”›tÇBN~£s‹>0]\ªHXÄ$“… �£;}«CÿÂhtçx™>´M�¤A£Ós"¤:Ë-Æ2ÞékL¶ò9ÆôݲÐ&•¸3ï9°ÓVäQ~&ò}o|ØŽ!7@ç?Û}%‚ t-ýudÃ>G?üfË,ÂGBMB
-377
View File
@@ -1,377 +0,0 @@
<?php
/** @file clicommand.inc
* @ingroup Phar
* @brief class CLICommand
* @author Marcus Boerger
* @date 2007 - 2007
*
* Phar Command
*/
/** @ingroup Phar
* @brief Abstract base console command implementation
* @author Marcus Boerger
* @version 1.0
*/
abstract class CLICommand
{
protected $argc;
protected $argv;
protected $cmds = array();
protected $args = array();
protected $typs = array();
function __construct($argc, array $argv)
{
$this->argc = $argc;
$this->argv = $argv;
$this->cmds = self::getCommands($this);
$this->typs = self::getArgTyps($this);
if ($argc < 2) {
self::error("No command given, check ${argv[0]} help\n");
} elseif (!isset($this->cmds[$argv[1]]['run'])) {
self::error("Unknown command '${argv[1]}', check ${argv[0]} help\n");
} else {
$command = $argv[1];
}
if (isset($this->cmds[$command]['arg'])) {
$this->args = call_user_func(array($this, $this->cmds[$command]['arg']));
$i = 1;
$missing = false;
while (++$i < $argc) {
if ($argv[$i][0] == '-') {
if (strlen($argv[$i]) == 2 && isset($this->args[$argv[$i][1]])) {
$arg = $argv[$i][1];
if (++$i >= $argc) {
self::error("Missing argument to parameter '$arg' of command '$command', check ${argv[0]} help\n");
} else {
$this->args[$arg]['val'] = $this->checkArgTyp($arg, $i, $argc, $argv);
}
} else {
self::error("Unknown parameter '${argv[$i]}' to command $command, check ${argv[0]} help\n");
}
} else {
break;
}
}
if (isset($this->args[''])) {
if ($i >= $argc) {
if (isset($this->args['']['require']) && $this->args['']['require']) {
self::error("Missing default trailing arguments to command $command, check ${argv[0]} help\n");
}
} else {
$this->args['']['val'] = array();
while($i < $argc) {
$this->args['']['val'][] = $argv[$i++];
}
}
} else if ($i < $argc) {
self::error("Unexpected default arguments to command $command, check ${argv[0]} help\n");
}
foreach($this->args as $arg => $inf) {
if (strlen($arg) && !isset($inf['val']) && isset($inf['required']) && $inf['required']) {
$missing .= "Missing parameter '-$arg' to command $command, check ${argv[0]} help\n";
}
}
if (strlen($missing))
{
self::error($missing);
}
}
call_user_func(array($this, $this->cmds[$command]['run']), $this->args);
}
static function notice ($msg)
{
fprintf(STDERR, $msg);
}
static function error ($msg, $exit_code = 1)
{
self::notice($msg);
exit($exit_code);
}
function checkArgTyp($arg, $i, $argc, $argv)
{
$typ = $this->args[$arg]['typ'];
if (isset($this->typs[$typ]['typ'])) {
return call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg], $arg);
} else {
return $argv[$i];
}
}
static function getSubFuncs(CLICommand $cmdclass, $prefix, array $subs)
{
$a = array();
$r = new ReflectionClass($cmdclass);
$l = strlen($prefix);
foreach($r->getMethods() as $m)
{
if (substr($m->name, 0, $l) == $prefix)
{
foreach($subs as $sub)
{
$what = substr($m->name, $l+strlen($sub)+1);
$func = $prefix . $sub . '_' . $what;
$what = str_replace('_', '-', $what);
if ($r->hasMethod($func))
{
if (!isset($a[$what]))
{
$a[$what] = array();
}
$a[$what][$sub] = /*$m->class . '::' .*/ $func;
}
}
}
}
return $a;
}
static function getCommands(CLICommand $cmdclass)
{
return self::getSubFuncs($cmdclass, 'cli_cmd_', array('arg','inf','run'));
}
static function getArgTyps(CLICommand $cmdclass)
{
return self::getSubFuncs($cmdclass, 'cli_arg_', array('typ'));
}
static function cli_arg_typ_bool($arg, $cfg, $key)
{
return (bool)$arg;
}
static function cli_arg_typ_int($arg, $cfg, $key)
{
if ((int)$arg != $arg) {
self::error("Argument to -$key must be an integer.\n");
}
return (int)$arg;
}
static function cli_arg_typ_regex($arg, $cfg, $key)
{
if (strlen($arg))
{
if (strlen($arg) > 1 && $arg[0] == $arg[strlen($arg)-1] && strpos('/,', $arg) !== false)
{
return $arg;
}
else
{
return '/' . $arg . '/';
}
}
else
{
return NULL;
}
}
static function cli_arg_typ_select($arg, $cfg, $key)
{
if (!in_array($arg, array_keys($cfg['select']))) {
self::error("Parameter value '$arg' not one of '" . join("', '", array_keys($cfg['select'])) . "'.\n");
}
return $arg;
}
static function cli_arg_typ_dir($arg, $cfg, $key)
{
$f = realpath($arg);
if ($f===false || !file_exists($f) || !is_dir($f)) {
self::error("Requested path '$arg' does not exist.\n");
}
return $f;
}
static function cli_arg_typ_file($arg)
{
$f = new SplFileInfo($arg);
$f = $f->getRealPath();
if ($f===false || !file_exists($f))
{
echo "Requested file '$arg' does not exist.\n";
exit(1);
}
return $f;
}
static function cli_arg_typ_filenew($arg, $cfg, $key)
{
$d = dirname($arg);
$f = realpath($d);
if ($f === false) {
self::error("Path for file '$arg' does not exist.\n");
}
return $f . '/' . basename($arg);
}
static function cli_arg_typ_filecont($arg, $cfg, $key)
{
return file_get_contents(self::cli_arg_typ_file($arg, $cfg, $key));
}
function cli_get_SP2($l1, $arg_inf)
{
return str_repeat(' ', $l1 + 2 + 4 + 8);
}
function cli_get_SP3($l1, $l2, $arg_inf)
{
return str_repeat(' ', $l1 + 2 + 4 + 8 + 2 + $l2 + 2);
}
static function cli_cmd_inf_help()
{
return "This help or help for a selected command.";
}
private function cli_wordwrap($what, $l, $sp)
{
$p = max(79 - $l, 40); // minimum length for paragraph
$b = substr($what, 0, $l); // strip out initial $l
$r = substr($what, $l); // remainder
$r = str_replace("\n", "\n".$sp, $r); // in remainder replace \n's
return $b . wordwrap($r, $p, "\n".$sp);
}
private function cli_help_get_args($func, $l, $sp, $required)
{
$inf = "";
foreach(call_user_func($func, $l, $sp) as $arg => $conf)
{
if ((isset($conf['required']) && $conf['required']) != $required)
{
continue;
}
if (strlen($arg))
{
$arg = "-$arg ";
}
else
{
$arg = "... ";
}
$sp2 = $this->cli_get_SP2($l, $inf);
$l2 = strlen($sp2);
$inf .= $this->cli_wordwrap($sp . $arg . $conf['inf'], $l2, $sp2) . "\n";
if (isset($conf['select']) && count($conf['select']))
{
$ls = 0;
foreach($conf['select'] as $opt => $what)
{
$ls = max($ls, strlen($opt));
}
$sp3 = $this->cli_get_SP3($l, $ls, $inf);
$l3 = strlen($sp3);
foreach($conf['select'] as $opt => $what)
{
$inf .= $this->cli_wordwrap($sp2 . " " . sprintf("%-${ls}s ", $opt) . $what, $l3, $sp3) . "\n";
}
}
}
if (strlen($inf))
{
if ($required)
{
return $sp . "Required arguments:\n\n" . $inf;
}
else
{
return $sp . "Optional arguments:\n\n". $inf;
}
}
}
function cli_cmd_arg_help()
{
return array('' => array('typ'=>'any','val'=>NULL,'inf'=>'Optional command to retrieve help for.'));
}
function cli_cmd_run_help()
{
$argv = $this->argv;
$which = $this->args['']['val'];
if (isset($which))
{
if (count($which) != 1) {
self::error("More than one command given.\n");
}
$which = $which[0];
if (!array_key_exists($which, $this->cmds)) {
self::error("Unknown command, cannot retrieve help.\n");
}
$l = strlen($which);
$cmds = array($which => $this->cmds[$which]);
} else {
echo "\n$argv[0] <command> [options]\n\n";
$l = 0;
ksort($this->cmds);
foreach($this->cmds as $name => $funcs) {
$l = max($l, strlen($name));
}
$inf = "Commands:";
$lst = "";
$ind = strlen($inf) + 1;
foreach($this->cmds as $name => $funcs)
{
$lst .= ' ' . $name;
}
echo $this->cli_wordwrap($inf.$lst, $ind, str_repeat(' ', $ind)) . "\n\n";
$cmds = $this->cmds;
}
$sp = str_repeat(' ', $l + 2);
foreach($cmds as $name => $funcs)
{
$inf = $name . substr($sp, strlen($name));
if (isset($funcs['inf']))
{
$inf .= $this->cli_wordwrap(call_user_func(array($this, $funcs['inf'])), $l, $sp) . "\n";
if (isset($funcs['arg']))
{
$inf .= "\n";
$inf .= $this->cli_help_get_args(array($this, $funcs['arg']), $l, $sp, true);
$inf .= "\n";
$inf .= $this->cli_help_get_args(array($this, $funcs['arg']), $l, $sp, false);
}
}
echo "$inf\n\n";
}
exit(0);
}
static function cli_cmd_inf_help_list()
{
return "Lists available commands.";
}
function cli_cmd_run_help_list()
{
ksort($this->cmds);
$lst = '';
foreach($this->cmds as $name => $funcs) {
$lst .= $name . ' ';
}
echo substr($lst, 0, -1) . "\n";
}
}
?>
-34
View File
@@ -1,34 +0,0 @@
<?php
/** @file directorygraphiterator.inc
* @ingroup Examples
* @brief class DirectoryGraphIterator
* @author Marcus Boerger
* @date 2003 - 2005
*
* SPL - Standard PHP Library
*/
/** @ingroup Examples
* @brief A tree iterator that only shows directories.
* @author Marcus Boerger
* @version 1.1
*/
class DirectoryGraphIterator extends DirectoryTreeIterator
{
function __construct($path)
{
RecursiveIteratorIterator::__construct(
new RecursiveCachingIterator(
new ParentIterator(
new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
)
),
CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
),
parent::SELF_FIRST
);
}
}
?>
-54
View File
@@ -1,54 +0,0 @@
<?php
/** @file directorytreeiterator.inc
* @ingroup Examples
* @brief class DirectoryTreeIterator
* @author Marcus Boerger
* @date 2003 - 2005
*
* SPL - Standard PHP Library
*/
/** @ingroup Examples
* @brief DirectoryIterator to generate ASCII graphic directory trees
* @author Marcus Boerger
* @version 1.1
*/
class DirectoryTreeIterator extends RecursiveIteratorIterator
{
/** Construct from a path.
* @param $path directory to iterate
*/
function __construct($path)
{
parent::__construct(
new RecursiveCachingIterator(
new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
),
CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
),
parent::SELF_FIRST
);
}
/** @return the current element prefixed with ASCII graphics
*/
function current()
{
$tree = '';
for ($l=0; $l < $this->getDepth(); $l++) {
$tree .= $this->getSubIterator($l)->hasNext() ? '| ' : ' ';
}
return $tree . ($this->getSubIterator($l)->hasNext() ? '|-' : '\-')
. $this->getSubIterator($l)->__toString();
}
/** Aggregates the inner iterator
*/
function __call($func, $params)
{
return call_user_func_array(array($this->getSubIterator(), $func), $params);
}
}
?>
-27
View File
@@ -1,27 +0,0 @@
<?php
/** @file invertedregexiterator.inc
* @ingroup Phar
* @brief class InvertedRegexIterator
* @author Marcus Boerger
* @date 2007 - 2007
*
* Inverted RegexIterator
*/
/** @ingroup Phar
* @brief Inverted RegexIterator
* @author Marcus Boerger
* @version 1.0
*/
class InvertedRegexIterator extends RegexIterator
{
/** @return !RegexIterator::accept()
*/
function accept()
{
return !RegexIterator::accept();
}
}
?>
-80
View File
@@ -1,80 +0,0 @@
<?php
/**
* @file phar.inc
* @ingroup Phar
* @brief class Phar
* @author Marcus Boerger
* @date 2007 - 2007
*
* Phar Command
*/
// {{{ class Phar extends PHP_Archive
/**
* Phar class
*
* @ingroup Phar
* @brief Phar implementation
* @author Marcus Boerger
* @version 1.0
*/
class Phar extends PHP_Archive implements RecursiveIterator
{
function getSignature()
{
return false;
}
function getAlias()
{
return false;
}
function rewind()
{
}
function valid()
{
return false;
}
function current()
{
}
function key()
{
}
function next()
{
}
function hasChildren()
{
return false;
}
function getChildren()
{
}
function hasMetadata()
{
}
function getMetadata()
{
}
function getStub()
{
}
function setStub()
{
}
}
?>
-57
View File
@@ -1,57 +0,0 @@
#!/usr/local/bin/php
<?php
/** @file phar.php
* @ingroup Phar
* @brief class CLICommand
* @author Marcus Boerger
* @date 2007 - 2007
*
* Phar Command
*/
if (!extension_loaded('phar'))
{
if (!class_exists('PHP_Archive', 0))
{
echo "Neither Extension Phar nor class PHP_Archive are available.\n";
exit(1);
}
if (!in_array('phar', stream_get_wrappers()))
{
stream_wrapper_register('phar', 'PHP_Archive');
}
if (!class_exists('Phar',0)) {
require 'phar://'.__FILE__.'/phar.inc';
}
}
foreach(array("SPL", "Reflection") as $ext)
{
if (!extension_loaded($ext))
{
echo "$argv[0] requires PHP extension $ext.\n";
exit(1);
}
}
function command_include($file)
{
$file = 'phar://' . __FILE__ . '/' . $file;
if (file_exists($file)) {
include($file);
}
}
function command_autoload($classname)
{
command_include(strtolower($classname) . '.inc');
}
Phar::mapPhar();
spl_autoload_register('command_autoload');
new PharCommand($argc, $argv);
__HALT_COMPILER(); ?>
File diff suppressed because it is too large. Load diff
-244
View File
@@ -1,244 +0,0 @@
/*
+----------------------------------------------------------------------+
| phar php single-file executable PHP extension |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Gregory Beaver <cellog@php.net> |
| Marcus Boerger <helly@php.net> |
| based on work by Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "phar_internal.h"
#define TAR_FILE '0'
#define TAR_LINK '1'
#define TAR_SYMLINK '2'
#define TAR_DIR '5'
#define TAR_NEW '8'
/**
* the format of the header block for a file, in the older UNIX-compatible
* TAR format
*/
typedef struct _old_tar_header { /* {{{ */
char name[100]; /* name of file;
directory is indicated by a trailing slash (/) */
char mode[8]; /* file mode */
char uid[8]; /* owner user ID */
char gid[8]; /* owner group ID */
char size[12]; /* length of file in bytes */
char mtime[12]; /* modify time of file */
char chksum[8]; /* checksum for header */
char link; /* indicator for links;
1 for a linked file,
2 for a symbolic link,
0 otherwise */
char linkname[100]; /* name of linked file */
} old_tar_header;
/* }}} */
/**
* the new USTAR header format.
* Note that tar can determine that the USTAR format is being used by the
* presence of the null-terminated string "ustar" in the magic field.
*/
typedef struct _tar_header { /* {{{ */
char name[100]; /* name of file */
char mode[8]; /* file mode */
char uid[8]; /* owner user ID */
char gid[8]; /* owner group ID */
char size[12]; /* length of file in bytes */
char mtime[12]; /* modify time of file */
char chksum[8]; /* checksum for header */
char typeflag; /* type of file
0 Regular file
1 Link to another file already archived
2 Symbolic link
3 Character special device
4 Block special device
5 Directory
6 FIFO special file
7 Reserved */
char linkname[100]; /* name of linked file */
char magic[6]; /* USTAR indicator */
char version[2]; /* USTAR version */
char uname[32]; /* owner user name */
char gname[32]; /* owner group name */
char devmajor[8]; /* device major number */
char devminor[8]; /* device minor number */
char prefix[155]; /* prefix for file name;
the value of the prefix field, if non-null,
is prefixed to the name field to allow names
longer then 100 characters */
} tar_header;
/* }}} */
typedef struct _tar_file tar_file;
typedef struct _tar_entry { /* {{{ */
tar_file *tar;
char type;
off_t start;
off_t pos;
off_t size;
mode_t mode;
time_t mtime;
uid_t uid;
gid_t gid;
union {
HashTable *content;
char *link;
} u;
} tar_entry;
/* }}} */
struct _tar_file { /* {{{ */
php_stream *stream;
char *real_name;
int refcount;
int opened;
tar_entry root;
};
/* }}} */
static int tar_number(char* buf, int len) /* {{{ */
{
int num = 0;
int i = 0;
while (i < len && buf[i] == ' ') {
i++;
}
while (i < len &&
buf[i] >= '0' &&
buf[i] <= '7') {
num = num * 8 + (buf[i] - '0');
i++;
}
return num;
}
/* }}} */
static int tar_checksum(char* buf, int len) /* {{{ */
{
int sum = 0;
char *end = buf + len;
while (buf != end) {
sum += (unsigned char)*buf;
buf++;
}
return sum;
}
/* }}} */
#define MAPPHAR_ALLOC_FAIL(msg) \
php_stream_close(fp);\
if (error) {\
spprintf(error, 0, msg, fname);\
}\
return FAILURE;
#ifdef WORDS_BIGENDIAN
# define PHAR_GET_32(buffer, var) \
var = ((((unsigned char*)(buffer))[3]) << 24) \
| ((((unsigned char*)(buffer))[2]) << 16) \
| ((((unsigned char*)(buffer))[1]) << 8) \
| (((unsigned char*)(buffer))[0]); \
(buffer) += 4
# define PHAR_GET_16(buffer, var) \
var = ((((unsigned char*)(buffer))[1]) << 8) \
| (((unsigned char*)(buffer))[0]); \
(buffer) += 2
#else
# define PHAR_GET_32(buffer, var) \
var = *(php_uint32*)(buffer); \
buffer += 4
# define PHAR_GET_16(buffer, var) \
var = *(php_uint16*)(buffer); \
buffer += 2
#endif
int phar2_open_file(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, long halt_offset, phar_archive_data** pphar, char *buffer, char **error TSRMLS_DC) /* {{{ */
{
/* The structure of a tar-based phar archive is as follows:
- the first file contains the loader stub and file hash. The file hash is a mapping
of filename hash to location of manifest data within the official phar manifest using
an implementation of open hash that allows the entire thing to be read in without any
processing beyond signature check.
- the second file contains the official phar manifest as used in phar 1.x
- third file to second-to-last file contain the phar's files
- final file contains the phar signature
*/
php_uint32 openhash_len;
phar_archive_data *mydata;
buffer += 6;
PHAR_GET_32(buffer), openhash_len);
if (openhash_len != sizeof(phar2_openhash) && openhash_len != sizeof(phar2_openhash_large)) {
MAPPHAR_ALLOC_FAIL("Corrupted phar2 archive, filename hash is wrong size in phar \"%s\"");
}
buffer -= 6;
buffer = (char *) erealloc((void *) buffer, openhash_len);
if (!buffer) {
MAPPHAR_ALLOC_FAIL("Could not allocate space for fast filename hash in phar \"%s\"");
}
if (openhash_len != php_stream_read(fp, buffer, openhash_len)) {
MAPPHAR_ALLOC_FAIL("Could not read fast filename hash in phar \"%s\"");
}
PHAR_G(fast_fname_map) = (phar2_openhash *) buffer;
mydata = ecalloc(sizeof(phar_archive_data), 1);
/* check whether we have meta data, zero check works regardless of byte order */
if (phar_parse_metadata(fp, &buffer, endbuffer, &mydata->metadata TSRMLS_CC) == FAILURE) {
MAPPHAR_FAIL("unable to read phar metadata in .phar file \"%s\"");
}
/* set up our manifest - entries will be created JIT as accessed */
zend_hash_init(&mydata->manifest, sizeof(phar_entry_info),
zend_get_hash_value, destroy_phar_manifest, 0);
snprintf(mydata->version, sizeof(mydata->version), "%u.%u.%u", manifest_ver >> 12, (manifest_ver >> 8) & 0xF, (manifest_ver >> 4) & 0xF);
mydata->internal_file_start = halt_offset + manifest_len + 4;
mydata->halt_offset = halt_offset;
mydata->flags = manifest_flags;
mydata->fp = fp;
mydata->fname = estrndup(fname, fname_len);
#ifdef PHP_WIN32
phar_unixify_path_separators(mydata->fname, fname_len);
#endif
mydata->fname_len = fname_len;
mydata->alias = alias ? estrndup(alias, alias_len) : mydata->fname;
mydata->alias_len = alias ? alias_len : fname_len;
mydata->sig_flags = sig_flags;
mydata->sig_len = sig_len;
mydata->signature = signature;
phar_request_initialize(TSRMLS_C);
zend_hash_add(&(PHAR_GLOBALS->phar_fname_map), mydata->fname, fname_len, (void*)&mydata, sizeof(phar_archive_data*), NULL);
if (register_alias) {
mydata->is_explicit_alias = 1;
zend_hash_add(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len, (void*)&mydata, sizeof(phar_archive_data*), NULL);
} else {
mydata->is_explicit_alias = 0;
}
efree(savebuf);
if (pphar) {
*pphar = mydata;
}
return SUCCESS;
}
/* }}} */
-34
View File
@@ -1,34 +0,0 @@
/*
+----------------------------------------------------------------------+
| phar php single-file executable PHP extension |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Gregory Beaver <cellog@php.net> |
| Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
BEGIN_EXTERN_C()
int phar2_open_file(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, long halt_offset, phar_archive_data** pphar, char *buffer, char **error TSRMLS_DC);
END_EXTERN_C()
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
-150
View File
@@ -1,150 +0,0 @@
/*
+----------------------------------------------------------------------+
| phar open hash implementation for phar2 tar-based archives |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Gregory Beaver <cellog@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "zend_hash.h"
static inline int phar2_openhash_doublehash(ulong k, int m, int i) /* {{{ */
{
/* implement double hash probing */
return ((k % m) + (i + (k % (m - 1)))) % m;
}
/* }}} */
phar2_openhash *phar2_openhash_init(int large) /* {{{ */
{
phar2_openhash *hash;
if (large) {
hash = (phar2_openhash *) ecalloc(sizeof(phar2_openhash_large));
} else {
hash = (phar2_openhash *) ecalloc(sizeof(phar2_openhash));
hash->is_large = '\001';
}
return hash;
}
/* }}} */
int phar2_openhash_destroy(phar2_openhash *hash) /* {{{ */
{
return efree(hash);
}
/* }}} */
/* retrieve the offset of this file's manifest entry. Returns offset or -1 */
long phar2_openhash_getoffset(phar2_openhash *hash, char *fname, int len) /* {{{ */
{
int myhash, hashsize;
char substr[20];
memset((void *) substr, 0, 20);
if (len < 20) {
memcpy((void *) &substr, (void *) fname, len);
} else {
memcpy((void *) &substr, (void *) fname + (len - 20), 20);
}
hashsize = (hash->is_large ? PHAR2_HASHSIZE : PHAR2_HASHSIZE_SMALL);
for (i = 0; i < hashsize; i ++) {
myhash = phar2_openhash_doublehash(zhash, hashsize, i);
if (hash->info[myhash].filepart[0]) {
if (!memcmp(hash->info[myhash].filepart, substr, 20)) {
/* found it */
return hash->info[myhash].offset;
}
} else {
/* empty - does not exist */
return -1;
}
}
return -1;
}
/* }}} */
static int phar2_openhash_insert_ex(phar2_openhash *hash, char* fname, ulong zhash, long offset) /* {{{ */
{
int myhash, hashsize;
hashsize = (hash->is_large ? PHAR2_HASHSIZE : PHAR2_HASHSIZE_SMALL);
for (i = 0; i < hashsize; i ++) {
myhash = phar2_openhash_doublehash(zhash, hashsize, i);
if (hash->info[myhash].filepart[0]) {
continue;
} else {
memcpy((void *) &hash->info[myhash].filepart, (void *) fname, 20);
hash->info[myhash].offset = offset;
hash->info[myhash].zhash = zhash;
hash->count++;
return SUCCESS;
}
}
return FAILURE;
}
/* }}} */
/* a super-large phar is being created, enlarge the hash and re-populate it */
phar2_openhash_large *phar2_openhash_enlarge(phar2_openhash *hash) /* {{{ */
{
phar_openhash_large *newhash = phar2_openhash_init(1);
for (phar2_openhash_entry s = newhash->info, int i = 0; i < hash->count; i++) {
if (!s[i].filepart[0]) {
continue;
}
phar2_openhash_insert_ex((phar2_openhash *)newhash, &(s[i].filepart), s[i].zhash, s[i].offset);
}
phar2_openhash_destroy(hash);
return newhash;
}
/* }}} */
int phar2_openhash_insert(phar2_openhash *hash, char* fname, int len, long offset) /* {{{ */
{
ulong zhash = zend_inline_hash_func(string, len);
char substr[20];
if (-1 != phar2_openhash_getoffset(hash, fname, len)) {
/* already exists, so fail */
return FAILURE;
}
if (hash->is_large) {
if (hash->count + 1 == PHAR_HASHSIZE) {
return FAILURE;
}
} else {
if (hash->count + 1 == PHAR_HASHSIZE_SMALL) {
/* resize for mega-huge phars */
hash = (phar2_openhash *) phar2_openhash_enlarge(hash);
}
}
memset((void *) substr, 0, 20);
if (len < 20) {
memcpy((void *) &substr, (void *) fname, len);
} else {
memcpy((void *) &substr, (void *) fname + (len - 20), 20);
}
return phar2_openhash_insert_ex(hash, substr, zhash, offset);
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
-59
View File
@@ -1,59 +0,0 @@
/*
+----------------------------------------------------------------------+
| phar open hash implementation for phar2 tar-based archives |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Gregory Beaver <cellog@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
/* maximum number of files that will fit into a phar */
#define PHAR2_HASHSIZE_SMALL 997
#define PHAR2_HASHSIZE 4999
typedef struct _phar2_openhash_entry {
char[20] filepart; /* last 10 characters of filename */
long offset; /* offset of this file's info in the manifest */
ulong zhash; /* value of zend_inline_hash_func() on the filename */
} phar2_openhash_entry;
typedef struct _phar2_openhash {
char is_large; /* always 0 */
int count;
phar2_openhash_entry info[PHAR2_HASHSIZE_SMALL];
} phar2_openhash;
typedef struct _phar2_openhash {
char is_large; /* always 1 */
int count;
phar2_openhash_entry info[PHAR2_HASHSIZE];
} phar2_openhash_large;
BEGIN_EXTERN_C()
phar2_openhash *phar2_openhash_init(int large);
int phar2_openhash_destroy(phar2_openhash *hash);
long phar2_openhash_getoffset(char *fname, int len);
int phar2_openhash_insert(phar2_openhash *hash, char* fname, int len, long offset);
END_EXTERN_C()
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
-313
View File
@@ -1,313 +0,0 @@
/*
+----------------------------------------------------------------------+
| phar php single-file executable PHP extension |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Gregory Beaver <cellog@php.net> |
| Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <time.h>
#include "php.h"
#include "php_ini.h"
#include "zend_constants.h"
#include "zend_execute.h"
#include "zend_exceptions.h"
#include "zend_hash.h"
#include "ext/phar/phar2_openhash.h"
#include "zend_interfaces.h"
#include "zend_operators.h"
#include "zend_qsort.h"
#include "main/php_streams.h"
#include "ext/standard/info.h"
#include "ext/standard/basic_functions.h"
#include "ext/standard/url.h"
#include "ext/standard/crc32.h"
#include "ext/standard/md5.h"
#include "ext/standard/sha1.h"
#include "ext/standard/php_var.h"
#include "ext/standard/php_smart_str.h"
#if HAVE_SPL
#include "ext/spl/spl_array.h"
#include "ext/spl/spl_directory.h"
#include "ext/spl/spl_engine.h"
#include "ext/spl/spl_exceptions.h"
#include "ext/spl/spl_iterators.h"
#endif
#if HAVE_GNUPGLIB
#include "ext/gnupg/php_gnupg.h"
#endif
#include "php_phar.h"
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#if HAVE_HASH_EXT
#include "ext/hash/php_hash.h"
#include "ext/hash/php_hash_sha.h"
#endif
#ifndef E_RECOVERABLE_ERROR
#define E_RECOVERABLE_ERROR E_ERROR
#endif
#define PHAR_EXT_VERSION_STR "2.0.0"
#define PHAR_API_VERSION_STR "2.0.0"
/* x.y.z maps to 0xyz0 */
#define PHAR_API_VERSION 0x2000
#define PHAR_API_MIN_READ 0x1000
#define PHAR_API_MAJORVERSION 0x2000
#define PHAR_API_MAJORVER_MASK 0xF000
#define PHAR_API_VER_MASK 0xFFF0
#define PHAR_HDR_COMPRESSION_MASK 0x0000F000
#define PHAR_HDR_COMPRESSED_NONE 0x00000000
#define PHAR_HDR_COMPRESSED_GZ 0x00001000
#define PHAR_HDR_COMPRESSED_BZ2 0x00002000
#define PHAR_HDR_SIGNATURE 0x00010000
#define PHAR_SIG_MD5 0x0001
#define PHAR_SIG_SHA1 0x0002
#define PHAR_SIG_SHA256 0x0003
#define PHAR_SIG_SHA512 0x0004
#define PHAR_SIG_PGP 0x0010
/* flags byte for each file adheres to these bitmasks.
All unused values are reserved */
#define PHAR_ENT_COMPRESSION_MASK 0x0000F000
#define PHAR_ENT_COMPRESSED_NONE 0x00000000
#define PHAR_ENT_COMPRESSED_GZ 0x00001000
#define PHAR_ENT_COMPRESSED_BZ2 0x00002000
#define PHAR_ENT_PERM_MASK 0x000001FF
#define PHAR_ENT_PERM_MASK_USR 0x000001C0
#define PHAR_ENT_PERM_SHIFT_USR 6
#define PHAR_ENT_PERM_MASK_GRP 0x00000038
#define PHAR_ENT_PERM_SHIFT_GRP 3
#define PHAR_ENT_PERM_MASK_OTH 0x00000007
#define PHAR_ENT_PERM_DEF_FILE 0x000001B6
#define PHAR_ENT_PERM_DEF_DIR 0x000001FF
ZEND_BEGIN_MODULE_GLOBALS(phar)
HashTable phar_fname_map;
HashTable phar_alias_map;
HashTable phar_plain_map;
phar2_openhash *fast_fname_map;
char* extract_list;
int readonly;
zend_bool readonly_orig;
zend_bool require_hash_orig;
int request_init;
int require_hash;
int request_done;
int request_ends;
int has_bz2:1;
int has_gnupg:1;
int has_zlib:1;
ZEND_END_MODULE_GLOBALS(phar)
ZEND_EXTERN_MODULE_GLOBALS(phar)
#ifdef ZTS
# include "TSRM.h"
# define PHAR_G(v) TSRMG(phar_globals_id, zend_phar_globals *, v)
# define PHAR_GLOBALS ((zend_phar_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(phar_globals_id)])
#else
# define PHAR_G(v) (phar_globals.v)
# define PHAR_GLOBALS (&phar_globals)
#endif
#ifndef php_uint16
# if SIZEOF_SHORT == 2
# define php_uint16 unsigned short
# else
# define php_uint16 uint16_t
# endif
#endif
#if HAVE_SPL
typedef union _phar_archive_object phar_archive_object;
typedef union _phar_entry_object phar_entry_object;
#endif
typedef struct _phar_archive_data phar_archive_data;
/* entry for one file in a phar file */
typedef struct _phar_entry_info {
/* first bytes are exactly as in file */
php_uint32 uncompressed_filesize;
php_uint32 timestamp;
php_uint32 compressed_filesize;
php_uint32 crc32;
php_uint32 flags;
/* remainder */
/* when changing compression, save old flags in case fp is NULL */
php_uint32 old_flags;
zval *metadata;
php_uint32 filename_len;
char *filename;
long offset_within_phar;
php_stream *fp;
php_stream *cfp;
int fp_refcount;
int is_crc_checked:1;
int is_modified:1;
int is_deleted:1;
/* used when iterating */
int is_dir:1;
phar_archive_data *phar;
smart_str metadata_str;
} phar_entry_info;
/* information about a phar file (the archive itself) */
struct _phar_archive_data {
char *fname;
int fname_len;
char *alias;
int alias_len;
char version[12];
size_t internal_file_start;
size_t halt_offset;
HashTable manifest;
php_uint32 flags;
php_uint32 min_timestamp;
php_uint32 max_timestamp;
php_stream *fp;
int refcount;
php_uint32 sig_flags;
int sig_len;
char *signature;
zval *metadata;
int is_explicit_alias:1;
int is_modified:1;
int is_writeable:1;
int is_brandnew:1;
/* defer phar creation */
int donotflush:1;
};
/* stream access data for one file entry in a phar file */
typedef struct _phar_entry_data {
phar_archive_data *phar;
/* stream position proxy, allows multiple open streams referring to the same fp */
php_stream *fp;
off_t position;
/* for copies of the phar fp, defines where 0 is */
off_t zero;
int for_write:1;
phar_entry_info *internal_file;
} phar_entry_data;
#if HAVE_SPL
/* archive php object */
union _phar_archive_object {
zend_object std;
spl_filesystem_object spl;
struct {
zend_object std;
phar_archive_data *archive;
} arc;
};
#endif
#if HAVE_SPL
/* entry php object */
union _phar_entry_object {
zend_object std;
spl_filesystem_object spl;
struct {
zend_object std;
phar_entry_info *entry;
} ent;
};
#endif
BEGIN_EXTERN_C()
void phar_request_initialize(TSRMLS_D);
void phar_object_init(TSRMLS_D);
int phar_open_filename(char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
int phar_open_or_create_filename(char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
int phar_open_compiled_file(char *alias, int alias_len, char **error TSRMLS_DC);
#ifdef PHAR_MAIN
static int phar_open_fp(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
static php_url* phar_open_url(php_stream_wrapper *wrapper, char *filename, char *mode, int options TSRMLS_DC);
static php_stream* phar_wrapper_open_url(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
static php_stream* phar_wrapper_open_dir(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC);
static int phar_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC);
static int phar_wrapper_stat(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC);
/* file/stream handlers */
static size_t phar_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC);
static size_t phar_stream_read( php_stream *stream, char *buf, size_t count TSRMLS_DC);
static int phar_stream_close(php_stream *stream, int close_handle TSRMLS_DC);
static int phar_stream_flush(php_stream *stream TSRMLS_DC);
static int phar_stream_seek( php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC);
static int phar_stream_stat( php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC);
/* directory handlers */
static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC);
static size_t phar_dir_read( php_stream *stream, char *buf, size_t count TSRMLS_DC);
static int phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC);
static int phar_dir_flush(php_stream *stream TSRMLS_DC);
static int phar_dir_seek( php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC);
static int phar_dir_stat( php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC);
#endif
int phar_archive_delref(phar_archive_data *phar TSRMLS_DC);
int phar_entry_delref(phar_entry_data *idata TSRMLS_DC);
phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int path_len, char **error TSRMLS_DC);
phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, int path_len, char dir, char **error TSRMLS_DC);
phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, char *mode, char **error TSRMLS_DC);
int phar_flush(phar_archive_data *archive, char *user_stub, long len, char **error TSRMLS_DC);
int phar_detect_phar_fname_ext(const char *filename, int check_length, char **ext_str, int *ext_len);
int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len TSRMLS_DC);
typedef enum {
pcr_use_query,
pcr_is_ok,
pcr_err_double_slash,
pcr_err_up_dir,
pcr_err_curr_dir,
pcr_err_back_slash,
pcr_err_star,
pcr_err_illegal_char,
pcr_err_empty_entry
} phar_path_check_result;
phar_path_check_result phar_path_check(char **p, int *len, const char **error);
END_EXTERN_C()
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
File diff suppressed because it is too large. Load diff
-196
View File
@@ -1,196 +0,0 @@
/* Generated by re2c 0.10.5 on Thu Feb 8 23:49:41 2007 */
#line 1 "ext/phar/phar_path_check.re"
/*
+----------------------------------------------------------------------+
| phar php single-file executable PHP extension |
+----------------------------------------------------------------------+
| Copyright (c) 2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "phar_internal.h"
phar_path_check_result phar_path_check(char **s, int *len, const char **error)
{
const unsigned char *p = (const unsigned char*)*s;
const unsigned char *m;
if (*len == 1 && *p == '.') {
*error = "current directory reference";
return pcr_err_curr_dir;
} else if (*len == 2 && p[0] == '.' && p[1] == '.') {
*error = "upper directory reference";
return pcr_err_up_dir;
}
#define YYCTYPE unsigned char
#define YYCURSOR p
#define YYLIMIT p+*len
#define YYMARKER m
#define YYFILL(n)
loop:
{
#line 48 "ext/phar/phar_path_check.c"
{
YYCTYPE yych;
if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
yych = *YYCURSOR;
if(yych <= '.') {
if(yych <= 0x0A) {
if(yych <= 0x00) goto yy13;
if(yych <= 0x09) goto yy10;
goto yy12;
} else {
if(yych <= 0x19) goto yy10;
if(yych == '*') goto yy6;
goto yy15;
}
} else {
if(yych <= '?') {
if(yych <= '/') goto yy2;
if(yych <= '>') goto yy15;
goto yy8;
} else {
if(yych == '\\') goto yy4;
if(yych <= 0x7F) goto yy15;
goto yy10;
}
}
yy2:
yych = *(YYMARKER = ++YYCURSOR);
if(yych <= 0x00) goto yy16;
if(yych <= '-') goto yy3;
if(yych <= '.') goto yy18;
if(yych <= '/') goto yy20;
yy3:
#line 97 "ext/phar/phar_path_check.re"
{
goto loop;
}
#line 86 "ext/phar/phar_path_check.c"
yy4:
++YYCURSOR;
#line 60 "ext/phar/phar_path_check.re"
{
*error = "back-slash";
return pcr_err_back_slash;
}
#line 94 "ext/phar/phar_path_check.c"
yy6:
++YYCURSOR;
#line 68 "ext/phar/phar_path_check.re"
{
*error = "star";
return pcr_err_star;
}
#line 102 "ext/phar/phar_path_check.c"
yy8:
++YYCURSOR;
#line 72 "ext/phar/phar_path_check.re"
{
if (**s == '/') {
(*s)++;
}
*len = (p - (const unsigned char*)*s) -1;
*error = NULL;
return pcr_use_query;
}
#line 114 "ext/phar/phar_path_check.c"
yy10:
++YYCURSOR;
yy11:
#line 80 "ext/phar/phar_path_check.re"
{
*error ="illegal character";
return pcr_err_illegal_char;
}
#line 123 "ext/phar/phar_path_check.c"
yy12:
yych = *++YYCURSOR;
goto yy11;
yy13:
++YYCURSOR;
#line 84 "ext/phar/phar_path_check.re"
{
if (**s == '/') {
(*s)++;
(*len)--;
}
if ((p - (const unsigned char*)*s) - 1 != *len)
{
*error ="illegal character";
return pcr_err_illegal_char;
}
*error = NULL;
return pcr_is_ok;
}
#line 143 "ext/phar/phar_path_check.c"
yy15:
yych = *++YYCURSOR;
goto yy3;
yy16:
++YYCURSOR;
#line 64 "ext/phar/phar_path_check.re"
{
*error = "empty directory";
return pcr_err_empty_entry;
}
#line 154 "ext/phar/phar_path_check.c"
yy18:
yych = *++YYCURSOR;
if(yych <= 0x00) goto yy23;
if(yych <= '-') goto yy19;
if(yych <= '.') goto yy22;
if(yych <= '/') goto yy23;
yy19:
YYCURSOR = YYMARKER;
goto yy3;
yy20:
++YYCURSOR;
#line 48 "ext/phar/phar_path_check.re"
{
*error = "double slash";
return pcr_err_double_slash;
}
#line 171 "ext/phar/phar_path_check.c"
yy22:
yych = *++YYCURSOR;
if(yych <= 0x00) goto yy25;
if(yych == '/') goto yy25;
goto yy19;
yy23:
++YYCURSOR;
#line 56 "ext/phar/phar_path_check.re"
{
*error = "current directory reference";
return pcr_err_curr_dir;
}
#line 184 "ext/phar/phar_path_check.c"
yy25:
++YYCURSOR;
#line 52 "ext/phar/phar_path_check.re"
{
*error = "upper directory reference";
return pcr_err_up_dir;
}
#line 192 "ext/phar/phar_path_check.c"
}
}
#line 100 "ext/phar/phar_path_check.re"
}
-101
View File
@@ -1,101 +0,0 @@
/*
+----------------------------------------------------------------------+
| phar php single-file executable PHP extension |
+----------------------------------------------------------------------+
| Copyright (c) 2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "phar_internal.h"
phar_path_check_result phar_path_check(char **s, int *len, const char **error)
{
const unsigned char *p = (const unsigned char*)*s;
const unsigned char *m;
if (*len == 1 && *p == '.') {
*error = "current directory reference";
return pcr_err_curr_dir;
} else if (*len == 2 && p[0] == '.' && p[1] == '.') {
*error = "upper directory reference";
return pcr_err_up_dir;
}
#define YYCTYPE unsigned char
#define YYCURSOR p
#define YYLIMIT p+*len
#define YYMARKER m
#define YYFILL(n)
loop:
/*!re2c
END = "\x00";
ILL = [\x01-\x19\x80-\xFF];
EOS = "/" | END;
ANY = .;
"//" {
*error = "double slash";
return pcr_err_double_slash;
}
"/.." EOS {
*error = "upper directory reference";
return pcr_err_up_dir;
}
"/." EOS {
*error = "current directory reference";
return pcr_err_curr_dir;
}
"\\" {
*error = "back-slash";
return pcr_err_back_slash;
}
"/" END {
*error = "empty directory";
return pcr_err_empty_entry;
}
"*" {
*error = "star";
return pcr_err_star;
}
"?" {
if (**s == '/') {
(*s)++;
}
*len = (p - (const unsigned char*)*s) -1;
*error = NULL;
return pcr_use_query;
}
ILL {
*error ="illegal character";
return pcr_err_illegal_char;
}
END {
if (**s == '/') {
(*s)++;
(*len)--;
}
if ((p - (const unsigned char*)*s) - 1 != *len)
{
*error ="illegal character";
return pcr_err_illegal_char;
}
*error = NULL;
return pcr_is_ok;
}
ANY {
goto loop;
}
*/
}
-45
View File
@@ -1,45 +0,0 @@
/*
+----------------------------------------------------------------------+
| phar php single-file executable PHP extension |
+----------------------------------------------------------------------+
| Copyright (c) 2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Gregory Beaver <cellog@php.net> |
| Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_PHAR_H
#define PHP_PHAR_H
#include "ext/standard/basic_functions.h"
extern zend_module_entry phar_module_entry;
#define phpext_phar_ptr &phar_module_entry
#ifdef PHP_WIN32
#define PHP_PHAR_API __declspec(dllexport)
#else
#define PHP_PHAR_API
#endif
#endif /* PHP_PHAR_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
-12
View File
@@ -1,12 +0,0 @@
--TEST--
Phar::apiVersion
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--FILE--
<?php
var_dump(Phar::apiVersion());
?>
===DONE===
--EXPECT--
string(5) "1.1.0"
===DONE===
-17
View File
@@ -1,17 +0,0 @@
--TEST--
Phar::mapPhar truncated manifest/improper params
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--FILE--
<?php
try {
Phar::mapPhar(5, 'hio', 'hi');
Phar::mapPhar();
} catch (Exception $e) {
echo $e->getMessage();
}
__HALT_COMPILER(); ?>
--EXPECTF--
Warning: Phar::mapPhar() expects at most 2 parameters, 3 given in %s002.php on line %d
internal corruption of phar "%s002.php" (truncated manifest at manifest length)
-13
View File
@@ -1,13 +0,0 @@
--TEST--
Phar::canCompress
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--FILE--
<?php
/* check this works and actually returns the boolean value */
var_dump(Phar::canCompress() == (
extension_loaded("zlib") || extension_loaded("bz2")
));
?>
--EXPECT--
bool(true)
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Phar::canCompress, specific
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--FILE--
<?php
var_dump(Phar::canCompress(Phar::GZ) == extension_loaded("zlib"));
var_dump(Phar::canCompress(Phar::BZ2) == extension_loaded("bz2"));
?>
===DONE===
--EXPECT--
bool(true)
bool(true)
===DONE===
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Phar::mapPhar no __HALT_COMPILER();
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--FILE--
<?php
try {
Phar::mapPhar('hio');
} catch (Exception $e) {
echo $e->getMessage();
}
?>
--EXPECTF--
__HALT_COMPILER(); must be declared in a phar
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Phar::mapPhar truncated manifest (none)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--FILE--
<?php
try {
Phar::mapPhar('hio');
} catch (Exception $e) {
echo $e->getMessage();
}
__HALT_COMPILER(); ?>()
--EXPECTF--
internal corruption of phar "%s" (truncated manifest at manifest length)
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Phar::mapPhar truncated manifest (manifest length truncated)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--FILE--
<?php
try {
Phar::mapPhar('hio');
} catch (Exception $e) {
echo $e->getMessage();
}
__HALT_COMPILER(); ?>
--EXPECTF--
internal corruption of phar "%s" (truncated manifest at manifest length)
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Phar::mapPhar manifest too big
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--FILE--
<?php
try {
Phar::mapPhar('hio');
} catch (Exception $e) {
echo $e->getMessage();
}
__HALT_COMPILER(); ?>~~~~
--EXPECTF--
manifest cannot be larger than 1 MB in phar "%s"
-21
View File
@@ -1,21 +0,0 @@
--TEST--
Phar::mapPhar truncated manifest (not enough for manifest length)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--FILE--
<?php
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$file .= pack('V', 500) . 'notenough';
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
try {
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
} catch (Exception $e) {
echo $e->getMessage();
}
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
internal corruption of phar "%s" (truncated manifest header)
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Phar::mapPhar too many manifest entries
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--INI--
phar.require_hash=0
--FILE--
<?php
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$file .= pack('VVnVVV', 500, 500, 0x1000, 0x00000000, 0, 0) . str_repeat('A', 500);
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
try {
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
} catch (Exception $e) {
echo $e->getMessage();
}
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
internal corruption of phar "%s009.phar.php" (too many manifest entries for size of manifest)
-29
View File
@@ -1,29 +0,0 @@
--TEST--
Phar::mapPhar buffer overrun
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--INI--
phar.require_hash=0
--FILE--
<?php
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
// this fails because the manifest length does not include the other 10 byte manifest data
$manifest = pack('V', 1) . 'a' . pack('VVVVVV', 0, time(), 0, crc32(''), 0x00000000, 0);
$file .= pack('VVnVV', strlen($manifest), 1, 0x1000, 0x00000000, 3) . 'hio' . pack('V', 0) . $manifest;
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
try {
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
echo file_get_contents('phar://hio/a');
} catch (Exception $e) {
echo $e->getMessage();
}
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
internal corruption of phar "%s" (too many manifest entries for size of manifest)
-30
View File
@@ -1,30 +0,0 @@
--TEST--
Phar::mapPhar filesize too small in manifest
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
// compressed file length does not match incompressed lentgh for an uncompressed file
$files = array();
$files['a'] = array('cont'=>'a','ulen'=>1,'clen'=>2);;
include 'phar_test.inc';
try {
include $fname;
echo file_get_contents('phar://hio/a');
} catch (Exception $e) {
echo $e->getMessage();
}
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
internal corruption of phar "%s" (compressed and uncompressed size does not match for uncompressed entry)
-25
View File
@@ -1,25 +0,0 @@
--TEST--
Phar::mapPhar valid file
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'a';
include 'phar_test.inc';
include $fname;
echo file_get_contents('phar://hio/a');
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
a
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Phar::mapPhar filesize mismatch
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
// filesize should be 1, and is 2
$files = array();
$files['a'] = array('cont'=>'a', 'ulen'=>2, 'clen'=>2);
include 'phar_test.inc';
echo file_get_contents($pname.'/a');
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: file_get_contents(phar://%s/a): failed to open stream: phar error: internal corruption of phar "%s" (%s file "a") in %s on line %d
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Phar::mapPhar filesize mismatch
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
// wrong crc32
$files = array();
$files['a'] = array('cont'=>'a', 'crc32'=>crc32('aX'));
include 'phar_test.inc';
echo file_get_contents($pname.'/a');
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: file_get_contents(phar://%s/a): failed to open stream: phar error: internal corruption of phar "%s" (crc32 mismatch on file "a") in %s on line %d
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Phar::mapPhar valid file (gzipped)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
<?php if (!extension_loaded("zlib")) print "skip zlib not present"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont'=>'a','comp'=>chr(75) . chr(4) . chr(0) /* 'a' gzdeflated */, 'flags'=>0x00001000);
include 'phar_test.inc';
echo file_get_contents($pname .'/a');
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
a
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Phar::mapPhar valid file (bzip2)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
<?php if (!extension_loaded("bz2")) print "skip bz2 not present"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont'=>'Hello World', 'comp'=>pack('H*', '425a6834314159265359065c89da0000009780400000400080060490002000310c082031a916c41d41e2ee48a70a1200cb913b40'),'flags'=>0x00002000);
include 'phar_test.inc';
var_dump(file_get_contents($pname . '/a'));
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(11) "Hello World"
-39
View File
@@ -1,39 +0,0 @@
--TEST--
Phar::mapPhar invalid file (gzipped file length is too short)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
<?php if (!extension_loaded("zlib")) print "skip zlib not present"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
// file length is too short
$files = array();
// "hi" gzdeflated
$files['a'] = array('cont'=>'a','comp'=> pack('H*', 'cbc80400'),'flags'=>0x00001000, 'ulen' => 1, 'clen' => 4);
$files['b'] = $files['a'];
$files['c'] = array('cont'=>'*');
$files['d'] = $files['a'];
include 'phar_test.inc';
var_dump(file_get_contents($pname . '/a'));
var_dump(file_get_contents($pname . '/b'));
var_dump(file_get_contents($pname . '/c'));
var_dump(file_get_contents($pname . '/d'));
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: file_get_contents(phar://%s/a): failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "a") in %s on line %d
bool(false)
Warning: file_get_contents(phar://%s/b): failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "b") in %s on line %d
bool(false)
string(1) "*"
Warning: file_get_contents(phar://%s/d): failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "d") in %s on line %d
bool(false)
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Phar::mapPhar invalid file (gzipped file length is too short)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
<?php if (!extension_loaded("zlib")) print "skip zlib not present"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
// file length is too short
$files = array();
$files['a'] = array('cont'=>'a','flags'=>0x00001000, 'clen' => 1);
include 'phar_test.inc';
echo file_get_contents($pname . '/a');
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: file_get_contents(phar://%s/a): failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "a") in %s on line %d
-25
View File
@@ -1,25 +0,0 @@
--TEST--
Phar: opendir test - no dir specified at all
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'abc';
include 'phar_test.inc';
include $fname;
$dir = opendir('phar://hio');
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: opendir(phar://hio): failed to open dir: phar error: no directory in "phar://hio", must have at least phar://hio/ for root directory (always use full path to a new phar) in %s on line %d
-33
View File
@@ -1,33 +0,0 @@
--TEST--
Phar: opendir test, root directory
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'a';
$files['b/a'] = 'b';
include 'phar_test.inc';
include $fname;
$dir = opendir('phar://hio/');
while (false !== ($a = readdir($dir))) {
var_dump($a);
var_dump(is_dir('phar://hio/' . $a));
}
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(1) "a"
bool(false)
string(1) "b"
bool(true)
-34
View File
@@ -1,34 +0,0 @@
--TEST--
Phar: opendir test, subdirectory
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
include 'phar_test.inc';
include $fname;
$dir = opendir('phar://hio/b');
while (false !== ($a = readdir($dir))) {
var_dump($a);
var_dump(is_dir('phar://hio/b/' . $a));
}
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(1) "a"
bool(false)
string(1) "c"
bool(true)
-65
View File
@@ -1,65 +0,0 @@
--TEST--
Phar: opendir test, recurse into
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
include 'phar_test.inc';
include $fname;
function dump($phar, $base)
{
var_dump($phar . $base);
$dir = opendir($phar . $base);
if ($base == '/')
{
$base = '';
}
while (false !== ($entry = readdir($dir))) {
$entry = $base . '/' . $entry;
var_dump($entry);
var_dump(is_dir($phar . $entry));
if (is_dir($phar . $entry))
{
dump($phar, $entry);
}
}
}
dump('phar://hio', '/');
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(11) "phar://hio/"
string(2) "/a"
bool(false)
string(2) "/b"
bool(true)
string(12) "phar://hio/b"
string(4) "/b/a"
bool(false)
string(4) "/b/c"
bool(true)
string(14) "phar://hio/b/c"
string(6) "/b/c/d"
bool(false)
string(4) "/bad"
bool(true)
string(14) "phar://hio/bad"
string(6) "/bad/c"
bool(false)
-73
View File
@@ -1,73 +0,0 @@
--TEST--
Phar: opendir test, recurse into
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
include 'phar_test.inc';
include $fname;
function dump($phar, $base)
{
var_dump($phar . $base);
$dir = opendir($phar . $base);
if ($base == '/')
{
$base = '';
}
while (false !== ($entry = readdir($dir))) {
$entry = $base . '/' . $entry;
var_dump($entry);
var_dump(is_dir($phar . $entry));
if (is_dir($phar . $entry))
{
dump($phar, $entry);
}
else
{
var_dump(file_get_contents($phar . $entry));
}
}
}
dump('phar://hio', '/');
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(11) "phar://hio/"
string(2) "/a"
bool(false)
string(1) "a"
string(2) "/b"
bool(true)
string(12) "phar://hio/b"
string(4) "/b/a"
bool(false)
string(1) "b"
string(4) "/b/c"
bool(true)
string(14) "phar://hio/b/c"
string(6) "/b/c/d"
bool(false)
string(1) "c"
string(4) "/bad"
bool(true)
string(14) "phar://hio/bad"
string(6) "/bad/c"
bool(false)
string(1) "d"
-136
View File
@@ -1,136 +0,0 @@
--TEST--
Phar: url stat
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$pfile = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$files = array();
$files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
include 'phar_test.inc';
include $fname;
var_dump(stat('phar://hio/a'), stat('phar://hio/b'));
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
array(26) {
[0]=>
int(12)
[1]=>
int(%d)
[2]=>
int(33060)
[3]=>
int(1)
[4]=>
int(0)
[5]=>
int(0)
[6]=>
int(-1)
[7]=>
int(1)
[8]=>
int(%d)
[9]=>
int(%d)
[10]=>
int(%d)
[11]=>
int(-1)
[12]=>
int(-1)
["dev"]=>
int(12)
["ino"]=>
int(%d)
["mode"]=>
int(33060)
["nlink"]=>
int(1)
["uid"]=>
int(0)
["gid"]=>
int(0)
["rdev"]=>
int(-1)
["size"]=>
int(1)
["atime"]=>
int(%d)
["mtime"]=>
int(%d)
["ctime"]=>
int(%d)
["blksize"]=>
int(-1)
["blocks"]=>
int(-1)
}
array(26) {
[0]=>
int(12)
[1]=>
int(%d)
[2]=>
int(16749)
[3]=>
int(1)
[4]=>
int(0)
[5]=>
int(0)
[6]=>
int(-1)
[7]=>
int(0)
[8]=>
int(%d)
[9]=>
int(%d)
[10]=>
int(%d)
[11]=>
int(-1)
[12]=>
int(-1)
["dev"]=>
int(12)
["ino"]=>
int(%d)
["mode"]=>
int(16749)
["nlink"]=>
int(1)
["uid"]=>
int(0)
["gid"]=>
int(0)
["rdev"]=>
int(-1)
["size"]=>
int(0)
["atime"]=>
int(%d)
["mtime"]=>
int(%d)
["ctime"]=>
int(%d)
["blksize"]=>
int(-1)
["blocks"]=>
int(-1)
}
-85
View File
@@ -1,85 +0,0 @@
--TEST--
Phar: stream stat
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'a';
$files['b/a'] = 'b';
$files['b/c/d'] = 'c';
$files['bad/c'] = 'd';
include 'phar_test.inc';
include $fname;
$fp = fopen('phar://hio/a', 'r');
var_dump(fstat($fp));
fclose($fp);
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
array(26) {
[0]=>
int(12)
[1]=>
int(%d)
[2]=>
int(33060)
[3]=>
int(1)
[4]=>
int(0)
[5]=>
int(0)
[6]=>
int(-1)
[7]=>
int(1)
[8]=>
int(%d)
[9]=>
int(%d)
[10]=>
int(%d)
[11]=>
int(-1)
[12]=>
int(-1)
["dev"]=>
int(12)
["ino"]=>
int(%d)
["mode"]=>
int(33060)
["nlink"]=>
int(1)
["uid"]=>
int(0)
["gid"]=>
int(0)
["rdev"]=>
int(-1)
["size"]=>
int(1)
["atime"]=>
int(%d)
["mtime"]=>
int(%d)
["ctime"]=>
int(%d)
["blksize"]=>
int(-1)
["blocks"]=>
int(-1)
}
-110
View File
@@ -1,110 +0,0 @@
--TEST--
Phar: stream stat
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'abcdefg';
include 'phar_test.inc';
include $fname;
$fp = fopen('phar://hio/a', 'r');
var_dump(ftell($fp));
echo 'fseek($fp, 1)';var_dump(fseek($fp, 1));
var_dump(ftell($fp));
echo 'fseek($fp, 1, SEEK_CUR)';var_dump(fseek($fp, 1, SEEK_CUR));
var_dump(ftell($fp));
echo 'fseek($fp, -1, SEEK_CUR)';var_dump(fseek($fp, -1, SEEK_CUR));
var_dump(ftell($fp));
echo 'fseek($fp, -1, SEEK_END)';var_dump(fseek($fp, -1, SEEK_END));
var_dump(ftell($fp));
echo 'fseek($fp, -8, SEEK_END)';var_dump(fseek($fp, -8, SEEK_END));
var_dump(ftell($fp));
echo 'fseek($fp, -7, SEEK_END)';var_dump(fseek($fp, -7, SEEK_END));
var_dump(ftell($fp));
echo 'fseek($fp, 0, SEEK_END)';var_dump(fseek($fp, 0, SEEK_END));
var_dump(ftell($fp));
echo 'fseek($fp, 1, SEEK_END)';var_dump(fseek($fp, 1, SEEK_END));
var_dump(ftell($fp));
echo 'fseek($fp, -8, SEEK_END)';var_dump(fseek($fp, -8, SEEK_END));
var_dump(ftell($fp));
echo 'fseek($fp, 6)';var_dump(fseek($fp, 6));
var_dump(ftell($fp));
echo 'fseek($fp, 8)';var_dump(fseek($fp, 8));
var_dump(ftell($fp));
echo 'fseek($fp, -1)';var_dump(fseek($fp, -1));
var_dump(ftell($fp));
echo "next\n";
fseek($fp, 4);
var_dump(ftell($fp));
echo 'fseek($fp, -5, SEEK_CUR)';var_dump(fseek($fp, -5, SEEK_CUR));
var_dump(ftell($fp));
fseek($fp, 4);
var_dump(ftell($fp));
echo 'fseek($fp, 5, SEEK_CUR)';var_dump(fseek($fp, 5, SEEK_CUR));
var_dump(ftell($fp));
fseek($fp, 4);
var_dump(ftell($fp));
echo 'fseek($fp, -4, SEEK_CUR)';var_dump(fseek($fp, -4, SEEK_CUR));
var_dump(ftell($fp));
fseek($fp, 4);
var_dump(ftell($fp));
echo 'fseek($fp, 3, SEEK_CUR)';var_dump(fseek($fp, 3, SEEK_CUR));
var_dump(ftell($fp));
fclose($fp);
?>
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
exit(0);
?>
--EXPECT--
int(0)
fseek($fp, 1)int(0)
int(1)
fseek($fp, 1, SEEK_CUR)int(0)
int(2)
fseek($fp, -1, SEEK_CUR)int(0)
int(1)
fseek($fp, -1, SEEK_END)int(0)
int(6)
fseek($fp, -8, SEEK_END)int(-1)
bool(false)
fseek($fp, -7, SEEK_END)int(0)
int(0)
fseek($fp, 0, SEEK_END)int(0)
int(7)
fseek($fp, 1, SEEK_END)int(-1)
bool(false)
fseek($fp, -8, SEEK_END)int(-1)
bool(false)
fseek($fp, 6)int(0)
int(6)
fseek($fp, 8)int(-1)
bool(false)
fseek($fp, -1)int(-1)
bool(false)
next
int(4)
fseek($fp, -5, SEEK_CUR)int(-1)
bool(false)
int(4)
fseek($fp, 5, SEEK_CUR)int(-1)
bool(false)
int(4)
fseek($fp, -4, SEEK_CUR)int(0)
int(0)
int(4)
fseek($fp, 3, SEEK_CUR)int(0)
int(7)
-32
View File
@@ -1,32 +0,0 @@
--TEST--
Phar: phar:// file_get_contents
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'phar_test.inc';
var_dump(file_get_contents($pname . '/a.php'));
var_dump(file_get_contents($pname . '/b.php'));
var_dump(file_get_contents($pname . '/b/c.php'));
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(28) "<?php echo "This is a\n"; ?>"
string(28) "<?php echo "This is b\n"; ?>"
string(30) "<?php echo "This is b/c\n"; ?>"
===DONE===
-32
View File
@@ -1,32 +0,0 @@
--TEST--
Phar: phar:// include
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'phar_test.inc';
include $pname . '/a.php';
include $pname . '/b.php';
include $pname . '/b/c.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
This is a
This is b
This is b/c
===DONE===
-32
View File
@@ -1,32 +0,0 @@
--TEST--
Phar: phar:// include (repeated names)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = '<?php echo "This is a\n"; ?>';
$files['b'] = '<?php echo "This is b\n"; ?>';
$files['b/b'] = '<?php echo "This is b/b\n"; ?>';
include 'phar_test.inc';
include $pname . '/a';
include $pname . '/b';
include $pname . '/b/b';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
This is a
This is b
This is b/b
===DONE===
-34
View File
@@ -1,34 +0,0 @@
--TEST--
Phar: phar:// require from within
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; require "'.$pname.'/b.php"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; require "'.$pname.'/b/c.php"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; require "'.$pname.'/b/d.php"; ?>';
$files['b/d.php'] = '<?php echo "This is b/d\n"; require "'.$pname.'/e.php"; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
include 'phar_test.inc';
require $pname . '/a.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
This is a
This is b
This is b/c
This is b/d
This is e
===DONE===
-62
View File
@@ -1,62 +0,0 @@
--TEST--
Phar: phar:// opendir
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; require "'.$pname.'/b.php"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; require "'.$pname.'/b/c.php"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; require "'.$pname.'/b/d.php"; ?>';
$files['b/d.php'] = '<?php echo "This is b/d\n"; require "'.$pname.'/e.php"; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
include 'phar_test.inc';
function dump($phar, $base)
{
var_dump(str_replace(dirname(__FILE__), '*', $phar) . $base);
$dir = opendir($phar . $base);
if ($base == '/')
{
$base = '';
}
while (false !== ($entry = readdir($dir))) {
$entry = $base . '/' . $entry;
var_dump($entry);
var_dump(is_dir($phar . $entry));
if (is_dir($phar . $entry))
{
dump($phar, $entry);
}
}
}
dump($pname, '/');
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
string(%d) "phar://*/027.phar.php/"
string(6) "/a.php"
bool(false)
string(2) "/b"
bool(true)
string(%d) "phar://*/027.phar.php/b"
string(8) "/b/c.php"
bool(false)
string(8) "/b/d.php"
bool(false)
string(6) "/b.php"
bool(false)
string(6) "/e.php"
bool(false)
===DONE===
-46
View File
@@ -1,46 +0,0 @@
--TEST--
Phar::loadPhar
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; include "'.$pname.'/b/c.php"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; include "'.$pname.'/b/d.php"; ?>';
$files['b/d.php'] = '<?php echo "This is b/d\n"; include "'.$pname.'/e.php"; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
include 'phar_test.inc';
Phar::loadPhar($fname, 'hio');
include $fname;
echo "======\n";
include $pname . '/a.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
This is a
This is b
This is b/c
This is b/d
This is e
======
This is a
This is b
This is b/c
This is b/d
This is e
===DONE===
-48
View File
@@ -1,48 +0,0 @@
--TEST--
Phar::loadPhar overloading alias names
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname1 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.php';
$fname = $fname1;
$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; include "'.$pname.'/b/c.php"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; include "'.$pname.'/b/d.php"; ?>';
$files['b/d.php'] = '<?php echo "This is b/d\n"; include "'.$pname.'/e.php"; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
include 'phar_test.inc';
file_put_contents($fname2, $file);
var_dump(Phar::loadPhar($fname1, 'hio'));
var_dump(Phar::loadPhar($fname1, 'copy'));
try
{
var_dump(Phar::loadPhar($fname2, 'copy'));
}
catch (Exception $e)
{
echo $e->getMessage() . "\n";
}
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php');
?>
--EXPECTF--
bool(true)
bool(true)
alias "copy" is already used for archive "%s029.1.phar.php" cannot be overloaded with "%s029.2.phar.php"
===DONE===
-38
View File
@@ -1,38 +0,0 @@
--TEST--
Phar::loadPhar ignoring alias
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; include "'.$pname.'/b/c.php"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; include "'.$pname.'/b/d.php"; ?>';
$files['b/d.php'] = '<?php echo "This is b/d\n"; include "'.$pname.'/e.php"; ?>';
$files['e.php'] = '<?php echo "This is e\n"; ?>';
include 'phar_test.inc';
Phar::loadPhar($fname);
require $pname . '/a.php';
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
?>
--EXPECTF--
This is a
This is b
This is b/c
This is b/d
This is e
===DONE===
-31
View File
@@ -1,31 +0,0 @@
--TEST--
Phar: include and parser error
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$pharconfig = 3;
require_once 'phar_oo_test.inc';
Phar::loadPhar($fname);
$pname = 'phar://' . $fname . '/a.php';
var_dump(file_get_contents($pname));
require $pname;
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/phar_oo_test.phar.php');
__halt_compiler();
?>
--EXPECTF--
string(25) "<?php echo new new class;"
Parse error: %s error%sunexpected%s in phar://%sphar_oo_test.phar.php/a.php on line %d
-29
View File
@@ -1,29 +0,0 @@
--TEST--
Phar: require hash
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=1
--FILE--
<?php
$pharconfig = 0;
require_once 'phar_oo_test.inc';
try {
Phar::loadPhar($fname);
} catch (Exception $e) {
echo $e->getMessage();
}
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/phar_oo_test.phar.php');
__halt_compiler();
?>
--EXPECTF--
phar "%sphar_oo_test.phar.php" does not have a signature===DONE===
-33
View File
@@ -1,33 +0,0 @@
--TEST--
Phar::chmod
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=0
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';
include 'phar_test.inc';
$a = new Phar($fname);
var_dump($a['a.php']->isExecutable());
$a['a.php']->chmod(0777);
var_dump($a['a.php']->isExecutable());
$a['a.php']->chmod(0666);
var_dump($a['a.php']->isExecutable());
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
?>
--EXPECTF--
bool(false)
bool(true)
bool(false)
===DONE===
-36
View File
@@ -1,36 +0,0 @@
--TEST--
Phar::chmod
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=1
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';
include 'phar_test.inc';
try {
$a = new Phar($fname);
var_dump($a['a.php']->isExecutable());
$a['a.php']->chmod(0777);
var_dump($a['a.php']->isExecutable());
$a['a.php']->chmod(0666);
var_dump($a['a.php']->isExecutable());
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
?>
--EXPECTF--
bool(false)
Cannot modify permissions for file "a.php" write operations are prohibited
===DONE===
-48
View File
@@ -1,48 +0,0 @@
--TEST--
Phar: create and modify phar
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
<?php if (!extension_loaded("spl")) print "skip SPL not available"; ?>
--INI--
phar.readonly=0
phar.require_hash=1
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
@unlink($fname);
file_put_contents($pname . '/a.php', "brand new!\n");
$phar = new Phar($fname);
$sig1 = $phar->getSignature();
include $pname . '/a.php';
file_put_contents($pname .'/a.php', "modified!\n");
file_put_contents($pname .'/b.php', "another!\n");
$phar = new Phar($fname);
$sig2 = $phar->getSignature();
var_dump($sig1['hash']);
var_dump($sig2['hash']);
var_dump($sig1['hash'] != $sig2['hash']);
include $pname . '/a.php';
include $pname . '/b.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
brand new!
string(40) "%s"
string(40) "%s"
bool(true)
modified!
another!
===DONE===
-21
View File
@@ -1,21 +0,0 @@
--TEST--
Phar: create a completely new phar
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=0
phar.require_hash=1
--FILE--
<?php
file_put_contents('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php',
'brand new!');
include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
brand new!
===DONE===
-29
View File
@@ -1,29 +0,0 @@
--TEST--
Phar: create a completely new phar
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=1
phar.require_hash=1
--FILE--
<?php
file_put_contents('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php',
'brand new!');
include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: file_put_contents(phar://%screate_new_phar_b.phar.php/a.php): failed to open stream: phar error: write operations disabled by INI setting in %screate_new_phar_b.php on line %d
Warning: include(%screate_new_phar_b.phar.php): failed to open stream: No such file or directory in %screate_new_phar_b.php on line %d
Warning: include(phar://%screate_new_phar_b.phar.php/a.php): failed to open stream: No such file or directory in %screate_new_phar_b.php on line %d
Warning: include(): Failed opening 'phar://%screate_new_phar_b.phar.php/a.php' for inclusion (include_path='%s') in %screate_new_phar_b.php on line %d
===DONE===
-29
View File
@@ -1,29 +0,0 @@
--TEST--
Phar: create a completely new phar
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
<?php if (!extension_loaded("spl")) print "skip SPL not available"; ?>
--INI--
phar.readonly=0
phar.require_hash=1
--FILE--
<?php
file_put_contents('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php',
'brand new!');
$phar = new Phar(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php');
var_dump($phar->getSignature());
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
array(2) {
["hash"]=>
string(40) "%s"
["hash_type"]=>
string(5) "SHA-1"
}
===DONE===
-64
View File
@@ -1,64 +0,0 @@
--TEST--
Phar: create with illegal path
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
<?php if (!extension_loaded("spl")) print "skip SPL not available"; ?>
--INI--
phar.readonly=0
phar.require_hash=1
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
@unlink($fname);
file_put_contents($pname . '/a.php?', "query");
file_put_contents($pname . '/b.php?bla', "query");
var_dump(file_get_contents($pname . '/a.php'));
var_dump(file_get_contents($pname . '/b.php'));
function error_handler($errno, $errmsg)
{
echo "Error: $errmsg\n";
}
set_error_handler('error_handler');
$checks = array('/', '.', '../', 'a/..', 'a/', 'b//a.php');
foreach($checks as $check)
{
file_put_contents($pname . '/' . $check, "error");
}
$phar = new Phar($fname);
$checks = array("a\0");
foreach($checks as $check)
{
try
{
$phar[$check] = 'error';
}
catch(Exception $e)
{
echo 'Exception: ' . $e->getMessage() . "\n";
}
}
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
string(5) "query"
string(5) "query"
Error: file_put_contents(phar://%s//): failed to open stream: phar error: invalid path "/" contains empty directory
Error: file_put_contents(phar://%s/.): failed to open stream: phar error: invalid path "." contains current directory reference
Error: file_put_contents(phar://%s/../): failed to open stream: phar error: invalid path "../" contains empty directory
Error: file_put_contents(phar://%s/a/..): failed to open stream: phar error: invalid path "a/.." contains upper directory reference
Error: file_put_contents(phar://%s/a/): failed to open stream: phar error: invalid path "a/" contains empty directory
Error: file_put_contents(phar://%s/b//a.php): failed to open stream: phar error: invalid path "b//a.php" contains double slash
Exception: Entry a does not exist and cannot be created: phar error: invalid path "a" contains illegal character
===DONE===
-31
View File
@@ -1,31 +0,0 @@
--TEST--
Phar: delete test
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=0
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$files = array();
$files['a'] = 'a';
include 'phar_test.inc';
include $fname;
$phar = new Phar($fname);
echo file_get_contents($pname . '/a') . "\n";
$phar->delete('a');
echo file_get_contents($pname . '/a') . "\n";
?>
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
a
Warning: file_get_contents(phar://%sdelete.phar.php/a): failed to open stream: phar error: "a" is not a file in phar "%sdelete.phar.php" in %sdelete.php on line 16
-48
View File
@@ -1,48 +0,0 @@
--TEST--
Phar: delete a file within a .phar
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=0
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'phar_test.inc';
include $pname . '/a.php';
include $pname . '/b.php';
include $pname . '/b/c.php';
unlink($pname . '/b/c.php');
?>
===AFTER===
<?php
include $pname . '/a.php';
include $pname . '/b.php';
include $pname . '/b/c.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
This is a
This is b
This is b/c
===AFTER===
This is a
This is b
Warning: include(%sdelete_in_phar.phar.php/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar.phar.php" in %sdelete_in_phar.php on line %d
Warning: include(): Failed opening 'phar://%sdelete_in_phar.phar.php/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar.php on line %d
===DONE===
-46
View File
@@ -1,46 +0,0 @@
--TEST--
Phar: delete a file within a .phar
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=1
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'phar_test.inc';
include $pname . '/a.php';
include $pname . '/b.php';
include $pname . '/b/c.php';
unlink($pname . '/b/c.php');
?>
===AFTER===
<?php
include $pname . '/a.php';
include $pname . '/b.php';
include $pname . '/b/c.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
This is a
This is b
This is b/c
Warning: unlink(): phar error: write operations disabled by INI setting in %sdelete_in_phar_b.php on line %d
===AFTER===
This is a
This is b
This is b/c
===DONE===
@@ -1,51 +0,0 @@
--TEST--
Phar: delete a file within a .phar (confirm disk file is changed)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=0
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'phar_test.inc';
include $pname . '/a.php';
include $pname . '/b.php';
include $pname . '/b/c.php';
$md5 = md5_file($fname);
unlink($pname . '/b/c.php');
clearstatcache();
$md52 = md5_file($fname);
if ($md5 == $md52) echo 'file was not modified';
?>
===AFTER===
<?php
include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php';
include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b.php';
include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
This is a
This is b
This is b/c
===AFTER===
This is a
This is b
Warning: include(%sdelete_in_phar_confirm.phar.php/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar_confirm.phar.php" in %sdelete_in_phar_confirm.php on line %d
Warning: include(): Failed opening 'phar://%sdelete_in_phar_confirm.phar.php/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar_confirm.php on line %d
===DONE===
-1
View File
@@ -1 +0,0 @@
<?php var_dump(__FILE__); ?>
-35
View File
@@ -1,35 +0,0 @@
--TEST--
Phar: extracted
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=0
phar.require_hash=0
phar.extract_list="phar_test.phar=test"
--FILE--
<?php
var_dump(Phar::getExtractList());
ini_set('phar.extract_list', 'phar_test.phar='.dirname(__FILE__));
var_dump(Phar::getExtractList());
$pname = 'phar://phar_test.phar';
var_dump(file_get_contents($pname . '/extracted.inc'));
include $pname . '/extracted.inc';
?>
===DONE===
--EXPECTF--
array(1) {
["phar_test.phar"]=>
string(4) "test"
}
array(1) {
["phar_test.phar"]=>
string(%d) "%s"
}
string(29) "<?php var_dump(__FILE__); ?>
"
string(%d) "%sextracted.inc"
===DONE===
-28
View File
@@ -1,28 +0,0 @@
--TEST--
Phar: test ini_set with readonly and require_hash enabled
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--INI--
phar.require_hash=1
phar.readonly=1
--FILE--
<?php
var_dump(ini_set('phar.require_hash', 1));
var_dump(ini_set('phar.readonly', 1));
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
var_dump(ini_set('phar.require_hash', 0));
var_dump(ini_set('phar.readonly', 0));
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
__HALT_COMPILER();
?>
--EXPECT--
string(1) "1"
string(1) "1"
string(1) "1"
string(1) "1"
string(1) "1"
string(1) "1"
string(1) "1"
string(1) "1"
-85
View File
@@ -1,85 +0,0 @@
--TEST--
Phar: test ini_set with readonly and require_hash disabled
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--INI--
phar.require_hash=0
phar.readonly=0
--FILE--
<?php
var_dump(ini_set('phar.require_hash', 1));
var_dump(ini_set('phar.readonly', 1));
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
ini_set('phar.require_hash', 0);
ini_set('phar.readonly', 0);
var_dump(Phar::canWrite());
?>
yes
<?php
var_dump(ini_set('phar.require_hash', 'yes'));
var_dump(ini_set('phar.readonly', 'yes'));
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
var_dump(Phar::canWrite());
ini_set('phar.require_hash', 0);
ini_set('phar.readonly', 0);
?>
on
<?php
var_dump(ini_set('phar.require_hash', 'on'));
var_dump(ini_set('phar.readonly', 'on'));
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
var_dump(Phar::canWrite());
ini_set('phar.require_hash', 0);
ini_set('phar.readonly', 0);
?>
true
<?php
var_dump(ini_set('phar.require_hash', 'true'));
var_dump(ini_set('phar.readonly', 'true'));
var_dump(Phar::canWrite());
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
?>
0
<?php
var_dump(ini_set('phar.require_hash', 0));
var_dump(ini_set('phar.readonly', 0));
var_dump(Phar::canWrite());
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
?>
===DONE===
--EXPECT--
string(1) "0"
string(1) "0"
string(1) "1"
string(1) "1"
bool(true)
yes
string(1) "0"
string(1) "0"
string(3) "yes"
string(3) "yes"
bool(false)
on
string(1) "0"
string(1) "0"
string(2) "on"
string(2) "on"
bool(false)
true
string(1) "0"
string(1) "0"
bool(false)
string(4) "true"
string(4) "true"
0
string(4) "true"
string(4) "true"
bool(true)
string(1) "0"
string(1) "0"
===DONE===
Binary file not shown.
-61
View File
@@ -1,61 +0,0 @@
--TEST--
Phar with meta-data (read)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont' => 'a');
$files['b'] = array('cont' => 'b', 'meta' => 'hi there');
$files['c'] = array('cont' => 'c', 'meta' => array('hi', 'there'));
$files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
include 'phar_test.inc';
foreach($files as $name => $cont) {
var_dump(file_get_contents($pname.'/'.$name));
}
$phar = new Phar($fname);
foreach($files as $name => $cont) {
var_dump($phar[$name]->getMetadata());
}
unset($phar);
foreach($files as $name => $cont) {
var_dump(file_get_contents($pname.'/'.$name));
}
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
NULL
string(8) "hi there"
array(2) {
[0]=>
string(2) "hi"
[1]=>
string(5) "there"
}
array(2) {
["hi"]=>
string(5) "there"
["foo"]=>
string(3) "bar"
}
string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
===DONE===
-61
View File
@@ -1,61 +0,0 @@
--TEST--
Phar with meta-data (write)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont' => 'a');
$files['b'] = array('cont' => 'b', 'meta' => 'hi there');
$files['c'] = array('cont' => 'c', 'meta' => array('hi', 'there'));
$files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
include 'phar_test.inc';
foreach($files as $name => $cont) {
var_dump(file_get_contents($pname.'/'.$name));
}
$phar = new Phar($fname);
$phar['a']->setMetadata(42);
$phar['b']->setMetadata(NULL);
$phar['c']->setMetadata(array(25, 'foo'=>'bar'));
$phar['d']->setMetadata(true);
foreach($files as $name => $cont) {
var_dump($phar[$name]->getMetadata());
}
unset($phar);
foreach($files as $name => $cont) {
var_dump(file_get_contents($pname.'/'.$name));
}
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
int(42)
NULL
array(2) {
[0]=>
int(25)
["foo"]=>
string(3) "bar"
}
bool(true)
string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
===DONE===
-79
View File
@@ -1,79 +0,0 @@
--TEST--
Phar with meta-data (write)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--INI--
phar.require_hash=0
phar.readonly=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont' => 'a');
$files['b'] = array('cont' => 'b', 'meta' => 'hi there');
$files['c'] = array('cont' => 'c', 'meta' => array('hi', 'there'));
$files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
include 'phar_test.inc';
foreach($files as $name => $cont) {
var_dump(file_get_contents($pname.'/'.$name));
}
$phar = new Phar($fname);
$phar->startBuffering();
$phar['a']->setMetadata(42);
$phar['b']->setMetadata(NULL);
$phar['c']->setMetadata(array(25, 'foo'=>'bar'));
$phar['d']->setMetadata(true);
foreach($files as $name => $cont) {
var_dump($phar[$name]->getMetadata());
}
$phar->stopBuffering();
unset($phar);
$phar = new Phar($fname);
foreach($files as $name => $cont) {
var_dump(file_get_contents($pname.'/'.$name));
}
foreach($files as $name => $cont) {
var_dump($phar[$name]->getMetadata());
}
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
int(42)
NULL
array(2) {
[0]=>
int(25)
["foo"]=>
string(3) "bar"
}
bool(true)
string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
int(42)
NULL
array(2) {
[0]=>
int(25)
["foo"]=>
string(3) "bar"
}
bool(true)
===DONE===
@@ -1,31 +0,0 @@
--TEST--
Phar: fopen a .phar for writing (existing file)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=0
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'phar_test.inc';
$fp = fopen($pname . '/b/c.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
include $pname . '/b/c.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
extra
===DONE===
@@ -1,42 +0,0 @@
--TEST--
Phar: fopen a .phar for writing (existing file)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=1
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'phar_test.inc';
function err_handler($errno, $errstr, $errfile, $errline) {
echo "Catchable fatal error: $errstr in $errfile on line $errline\n";
}
set_error_handler("err_handler", E_RECOVERABLE_ERROR);
$fp = fopen($pname . '/b/c.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
include $pname . '/b/c.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_existing_b.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_b.php on line %d
Warning: fwrite(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d
Warning: fclose(): supplied argument is not a valid stream resource in %spen_for_write_existing_b.php on line %d
This is b/c
===DONE===
@@ -1,36 +0,0 @@
--TEST--
Phar: fopen a .phar for writing (existing file)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=1
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'phar_test.inc';
$fp = fopen($pname . '/b/c.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
include $pname . '/b/c.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_existing_c.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_existing_c.php on line %d
Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d
Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d
This is b/c
===DONE===
@@ -1,33 +0,0 @@
--TEST--
Phar: fopen a .phar for writing (new file)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=0
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'phar_test.inc';
$fp = fopen($pname . '/b/new.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
include $pname . '/b/c.php';
include $pname . '/b/new.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
This is b/c
extra
===DONE===
@@ -1,49 +0,0 @@
--TEST--
Phar: fopen a .phar for writing (new file)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=1
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'phar_test.inc';
function err_handler($errno, $errstr, $errfile, $errline) {
echo "Catchable fatal error: $errstr in $errfile on line $errline\n";
}
set_error_handler("err_handler", E_RECOVERABLE_ERROR);
$fp = fopen($pname . '/b/new.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
include $pname . '/b/c.php';
include $pname . '/b/new.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_b.php on line %d
Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d
Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line 20
This is b/c
Warning: include(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.php" in %sopen_for_write_newfile_b.php on line 22
Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b.phar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b.php on line %d
===DONE===
@@ -1,43 +0,0 @@
--TEST--
Phar: fopen a .phar for writing (new file)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.readonly=1
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
$files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'phar_test.inc';
$fp = fopen($pname . '/b/new.php', 'wb');
fwrite($fp, 'extra');
fclose($fp);
include $pname . '/b/c.php';
include $pname . '/b/new.php';
?>
===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
Warning: fopen(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by INI setting in %sopen_for_write_newfile_c.php on line %d
Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d
Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d
This is b/c
Warning: include(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.php" in %sopen_for_write_newfile_c.php on line %d
Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_c.phar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_c.php on line %d
===DONE===
@@ -1,50 +0,0 @@
--TEST--
Phar::startBuffering()/setStub()/stopBuffering()
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
phar.readonly=0
--FILE--
<?php
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
//var_dump($p->getStub());
var_dump($p->isBuffering());
$p->startBuffering();
var_dump($p->isBuffering());
$p['a.php'] = '<?php var_dump("Hello");';
$p->setStub('<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>');
include 'phar://brandnewphar.phar/a.php';
var_dump($p->getStub());
$p['b.php'] = '<?php var_dump("World");';
$p->setStub('<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER();');
include 'phar://brandnewphar.phar/b.php';
var_dump($p->getStub());
$p->stopBuffering();
echo "===COMMIT===\n";
var_dump($p->isBuffering());
include 'phar://brandnewphar.phar/a.php';
include 'phar://brandnewphar.phar/b.php';
var_dump($p->getStub());
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/brandnewphar.phar');
?>
--EXPECT--
bool(true)
bool(false)
string(5) "Hello"
string(84) "<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
"
string(5) "World"
string(85) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
"
===COMMIT===
bool(true)
string(5) "Hello"
string(5) "World"
string(85) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
"
===DONE===
-42
View File
@@ -1,42 +0,0 @@
--TEST--
Phar::setStub()/stopBuffering()
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
phar.readonly=0
--FILE--
<?php
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
$p['file1.txt'] = 'hi';
$p->stopBuffering();
var_dump($p->getStub());
$p->setStub("<?php
function __autoload(\$class)
{
include 'phar://' . str_replace('_', '/', \$class);
}
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER();
?>");
var_dump($p->getStub());
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/brandnewphar.phar');
?>
--EXPECT--
string(29) "<?php __HALT_COMPILER(); ?>
"
string(200) "<?php
function __autoload($class)
{
include 'phar://' . str_replace('_', '/', $class);
}
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER(); ?>
"
===DONE===
-46
View File
@@ -1,46 +0,0 @@
--TEST--
Phar: attempt to create a Phar with relative path
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
--INI--
phar.require_hash=0
phar.readonly=0
--FILE--
<?php
chdir(dirname(__FILE__));
try {
$p = new Phar('brandnewphar.phar');
$p['file1.txt'] = 'hi';
var_dump($p->getStub());
$p->setStub("<?php
function __autoload(\$class)
{
include 'phar://' . str_replace('_', '/', \$class);
}
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER();
?>");
var_dump($p->getStub());
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/brandnewphar.phar');
?>
--EXPECT--
string(29) "<?php __HALT_COMPILER(); ?>
"
string(200) "<?php
function __autoload($class)
{
include 'phar://' . str_replace('_', '/', $class);
}
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER(); ?>
"
===DONE===
-100
View File
@@ -1,100 +0,0 @@
--TEST--
Phar context
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
<?php if (!extension_loaded("zlib")) print "skip zlib not present"; ?>
--INI--
phar.require_hash=0
phar.readonly=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = '<?php __HALT_COMPILER(); ?>';
$files = array();
$files['a'] = 'a';
$files['b'] = 'b';
$files['c'] = 'c';
include 'phar_test.inc';
$phar = new Phar($fname);
var_dump(file_get_contents($pname . '/a'));
var_dump($phar['a']->isCompressed());
var_dump(file_get_contents($pname . '/b'));
var_dump($phar['b']->isCompressed());
var_dump(file_get_contents($pname . '/c'));
var_dump($phar['c']->isCompressed());
$context = stream_context_create(array('phar'=> array('compress'=>Phar::GZ, 'metadata' => array(2, 'hi' => 3))));
$context2 = stream_context_create(array('phar' => array('metadata' => array(4))));
file_put_contents($pname . '/a', 'new a', 0); // no compression
file_put_contents($pname . '/b', 'new b', 0, $context);
file_put_contents($pname . '/d', 'new d', 0, $context2);
$phar = new Phar($fname);
var_dump(file_get_contents($pname . '/a'));
var_dump($phar['a']->isCompressed());
var_dump($phar['a']->getMetaData());
var_dump(file_get_contents($pname . '/b'));
var_dump($phar['b']->isCompressed());
var_dump($phar['b']->getMetaData());
var_dump(file_get_contents($pname . '/c'));
var_dump($phar['c']->isCompressed());
var_dump($phar['c']->getMetaData());
var_dump(file_get_contents($pname . '/d'));
var_dump($phar['d']->isCompressed());
var_dump($phar['d']->getMetaData());
$context2 = stream_context_create(array('phar' => array('metadata' => array(4))));
$fp = fopen($pname . '/b', 'r+', 0, $context2);
fclose($fp);
?>
==AFTER==
<?php
var_dump(file_get_contents($pname . '/b'));
var_dump($phar['b']->isCompressed());
var_dump($phar['b']->getMetaData());
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
?>
--EXPECT--
string(1) "a"
bool(false)
string(1) "b"
bool(false)
string(1) "c"
bool(false)
string(5) "new a"
bool(false)
NULL
string(5) "new b"
bool(true)
array(2) {
[0]=>
int(2)
["hi"]=>
int(3)
}
string(1) "c"
bool(false)
NULL
string(5) "new d"
bool(false)
array(1) {
[0]=>
int(4)
}
==AFTER==
string(5) "new b"
bool(true)
array(1) {
[0]=>
int(4)
}
===DONE===
-31
View File
@@ -1,31 +0,0 @@
--TEST--
Phar object: iterate test with sub-directories and RecursiveIteratorIterator
--SKIPIF--
<?php if (!extension_loaded('phar')) die('skip'); ?>
<?php if (!extension_loaded("spl")) print "skip SPL not available"; ?>
--INI--
phar.readonly=0
phar.require_hash=0
--FILE--
<?php
$phar = new Phar(dirname(__FILE__) . '/test.phar');
$phar['top.txt'] = 'hi';
$phar['sub/top.txt'] = 'there';
$phar['another.file.txt'] = 'wowee';
$newphar = new Phar(dirname(__FILE__) . '/test.phar');
foreach (new RecursiveIteratorIterator($newphar) as $path => $obj) {
var_dump($obj->getPathName());
}
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/test.phar');
__halt_compiler();
?>
--EXPECTF--
string(%d) "phar://%stest.phar/another.file.txt"
string(%d) "phar://%stest.phar/sub/top.txt"
string(%d) "phar://%stest.phar/top.txt"
===DONE===
@@ -1,22 +0,0 @@
--TEST--
Phar::getSupportedCompression() (bz2 and zlib)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
<?php if (!extension_loaded("spl")) print "skip SPL not available"; ?>
<?php if (!extension_loaded("bz2")) print "skip bz2 not available"; ?>
<?php if (!extension_loaded("zlib")) print "skip zlib not available"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
var_dump(Phar::getSupportedCompression());
?>
===DONE===
--EXPECT--
array(2) {
[0]=>
string(2) "GZ"
[1]=>
string(5) "BZIP2"
}
===DONE===
@@ -1,20 +0,0 @@
--TEST--
Phar::getSupportedCompression() (bz2)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
<?php if (!extension_loaded("spl")) print "skip SPL not available"; ?>
<?php if (!extension_loaded("bz2")) print "skip bz2 not available"; ?>
<?php if (extension_loaded("zlib")) print "skip zlib is available"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
var_dump(Phar::getSupportedCompression());
?>
===DONE===
--EXPECT--
array(1) {
[0]=>
string(5) "BZIP2"
}
===DONE===
@@ -1,20 +0,0 @@
--TEST--
Phar::getSupportedCompression() (zlib)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
<?php if (!extension_loaded("spl")) print "skip SPL not available"; ?>
<?php if (extension_loaded("bz2")) print "skip bz2 is available"; ?>
<?php if (!extension_loaded("zlib")) print "skip zlib not available"; ?>
--INI--
phar.require_hash=0
--FILE--
<?php
var_dump(Phar::getSupportedCompression());
?>
===DONE===
--EXPECT--
array(1) {
[0]=>
string(2) "GZ"
}
===DONE===
@@ -1,16 +0,0 @@
--TEST--
Phar::getSupportedCompression() (none)
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
<?php if (!extension_loaded("spl")) print "skip SPL not available"; ?>
<?php if (extension_loaded("bz2")) print "skip bz2 is available"; ?>
<?php if (extension_loaded("zlib")) print "skip zlib is available"; ?>
--FILE--
<?php
var_dump(Phar::getSupportedCompression());
?>
===DONE===
--EXPECT--
array(0) {
}
===DONE===
@@ -1,22 +0,0 @@
--TEST--
Phar::setSupportedSignatures()
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip"; ?>
<?php if ( extension_loaded("hash")) print "skip extension hash conflicts"; ?>
--INI--
phar.require_hash=0
phar.readonly=0
--FILE--
<?php
var_dump(Phar::getSupportedSignatures());
?>
===DONE===
?>
--EXPECT--
array(2) {
[0]=>
string(3) "MD5"
[1]=>
string(5) "SHA-1"
}
===DONE===
Loaded 100 of 226 files, more files were not shown because too many files have changed in this diff. Show more