return SUCCESS;
} else {
/* file exists, but is either corrupt or not a phar archive */
- php_stream_close(fp);
if (actual) {
efree(actual);
}
if (!phar_has_zlib) {
MAPPHAR_ALLOC_FAIL("unable to decompress gzipped phar archive \"%s\" to temporary file, enable zlib extension in php.ini")
}
+ INIT_ZVAL(filterparams);
array_init(&filterparams);
/* this is defined in zlib's zconf.h */
#ifndef MAX_WBITS
MAPPHAR_ALLOC_FAIL("unable to decompress gzipped phar archive \"%s\", ext/zlib is buggy in PHP versions older than 5.2.6")
}
}
- zval_dtor(&filterparams);
php_stream_filter_append(&temp->writefilters, filter);
if (0 == php_stream_copy_to_stream(fp, temp, PHP_STREAM_COPY_ALL)) {
if (err) {
/* to properly compress, we have to tell zlib to add a zlib header */
zval filterparams;
+ INIT_ZVAL(filterparams);
array_init(&filterparams);
add_assoc_long(&filterparams, "window", MAX_WBITS+16);
filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC);
- zval_dtor(&filterparams);
if (!filter) {
if (error) {
spprintf(error, 4096, "unable to compress all contents of phar \"%s\" using zlib, PHP versions older than 5.2.6 have a buggy zlib", phar->fname);
#endif
add_assoc_long(&filterparams, "window", MAX_WBITS + 16);
filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC);
- zval_dtor(&filterparams);
if (!filter) {
/* copy contents uncompressed rather than lose them */
php_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL);
unlink(dirname(__FILE__) . '/brandnewphar.phar');
?>
--EXPECT--
-int(7133)
+int(6591)
string(200) "<?php
function __autoload($class)
{
--- /dev/null
+--TEST--
+test broken app
+--INI--
+phar.readonly=0
+--FILE--
+<?php
+$file = "zfapp";
+$tgz_file = dirname(__FILE__) . "/$file.tgz";
+chdir(dirname(__FILE__));
+$phar_file = basename(__FILE__, '.php') . '.phar.php';
+@unlink($phar_file);
+copy($tgz_file, $phar_file);
+$a = new Phar($phar_file);
+$a->startBuffering();
+$a->setStub("<?php
+Phar::interceptFileFuncs();
+Phar::webPhar('$file.phar', 'html/index.php');
+echo 'BlogApp is intended to be executed from a web browser\n';
+exit -1;
+__HALT_COMPILER();
+");
+$a->stopBuffering();
+foreach(new RecursiveIteratorIterator($a, RecursiveIteratorIterator::LEAVES_ONLY) as $f) {
+echo $f->getPathName() . "\n";
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
+__HALT_COMPILER();
+?>
+--EXPECT--
+===DONE===
entry.fp_type = PHAR_FP;
#define PHAR_ZIP_FAIL(errmsg) \
zend_hash_destroy(&mydata->manifest); \
+ mydata->manifest.arBuckets = 0; \
php_stream_close(fp); \
if (mydata->metadata) { \
zval_dtor(mydata->metadata); \