- IS_UNICODE checks and conversions

- stub and creation file updates
- far too many test updates to think about
This commit is contained in:
Steph Fox 2008-05-19 19:05:42 +00:00
parent 69deb7bc42
commit f08aea109b
194 changed files with 579 additions and 551 deletions

View file

@ -635,7 +635,12 @@ PHP_METHOD(Phar, webPhar)
return;
}
switch (Z_TYPE_P(retval_ptr)) {
case IS_STRING :
#if PHP_VERSION_ID >= 60000
case IS_UNICODE:
zval_unicode_to_string(retval_ptr TSRMLS_CC);
/* break intentionally omitted */
#endif
case IS_STRING:
efree(entry);
if (fci.retval_ptr_ptr != &retval_ptr) {
entry = estrndup(Z_STRVAL_PP(fci.retval_ptr_ptr), Z_STRLEN_PP(fci.retval_ptr_ptr));
@ -831,7 +836,12 @@ PHP_METHOD(Phar, webPhar)
RETURN_FALSE;
}
break;
case IS_STRING :
#if PHP_VERSION_ID >= 60000
case IS_UNICODE:
zval_unicode_to_string(*(val) TSRMLS_CC);
/* break intentionally omitted */
#endif
case IS_STRING:
PHAR_SET_USER_MIME(PHAR_MIME_OTHER)
break;
default :
@ -884,10 +894,18 @@ PHP_METHOD(Phar, mungServer)
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "unable to retrieve array value in Phar::mungServer()");
return;
}
#if PHP_VERSION_ID >= 60000
if (Z_TYPE_PP(data) == IS_UNICODE) {
zval_unicode_to_string(*(data) TSRMLS_CC);
}
#endif
if (Z_TYPE_PP(data) != IS_STRING) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Non-string value passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
return;
}
if (!php_self && Z_STRLEN_PP(data) == sizeof("PHP_SELF")-1 && !strncmp(Z_STRVAL_PP(data), "PHP_SELF", sizeof("PHP_SELF")-1)) {
if (SUCCESS != zend_hash_add_empty_element(&(PHAR_GLOBALS->phar_SERVER_mung_list), "PHP_SELF", sizeof("PHP_SELF")-1)) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Unable to add PHP_SELF to Phar::mungServer() list of values to mung");
@ -1340,16 +1358,21 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
}
if (!value) {
/* failure in get_current_data */
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned no value", ce->name);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned no value", ce->name);
return ZEND_HASH_APPLY_STOP;
}
switch (Z_TYPE_PP(value)) {
case IS_STRING :
#if PHP_VERSION_ID >= 60000
case IS_UNICODE:
zval_unicode_to_string(*(value) TSRMLS_CC);
/* break intentionally omitted */
#endif
case IS_STRING:
break;
case IS_RESOURCE :
case IS_RESOURCE:
php_stream_from_zval_no_verify(fp, value);
if (!fp) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Iterator %s returned an invalid stream handle", ce->name);
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Iterator %v returned an invalid stream handle", ce->name);
return ZEND_HASH_APPLY_STOP;
}
if (iter->funcs->get_current_key) {
@ -1359,29 +1382,28 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
return ZEND_HASH_APPLY_STOP;
}
PHAR_STR(key, str_key);
if (key_type == HASH_KEY_IS_LONG) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned an invalid key (must return a string)", ce->name);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned an invalid key (must return a string)", ce->name);
return ZEND_HASH_APPLY_STOP;
}
PHAR_STR(key, str_key);
save = str_key;
if (str_key[str_key_len - 1] == '\0') str_key_len--;
} else {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned an invalid key (must return a string)", ce->name);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned an invalid key (must return a string)", ce->name);
return ZEND_HASH_APPLY_STOP;
}
close_fp = 0;
opened = (char *) estrndup(str, sizeof("[stream]") + 1);
goto after_open_fp;
case IS_OBJECT :
case IS_OBJECT:
if (instanceof_function(Z_OBJCE_PP(value), spl_ce_SplFileInfo TSRMLS_CC)) {
char *test = NULL;
zval dummy;
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(*value TSRMLS_CC);
if (!base_len) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Iterator %s returns an SplFileInfo object, so base directory must be specified", ce->name);
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Iterator %v returns an SplFileInfo object, so base directory must be specified", ce->name);
return ZEND_HASH_APPLY_STOP;
}
switch (intern->type) {
@ -1411,7 +1433,11 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
goto phar_spl_fileinfo;
case SPL_FS_INFO:
case SPL_FS_FILE:
#if PHP_VERSION_ID >= 60000
fname = expand_filepath(intern->file_name.s, NULL TSRMLS_CC);
#else
fname = expand_filepath(intern->file_name, NULL TSRMLS_CC);
#endif
fname_len = strlen(fname);
save = fname;
is_splfileinfo = 1;
@ -1420,7 +1446,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
}
/* fall-through */
default :
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned an invalid value (must return a string)", ce->name);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned an invalid value (must return a string)", ce->name);
return ZEND_HASH_APPLY_STOP;
}
@ -1447,7 +1473,7 @@ phar_spl_fileinfo:
str_key_len--;
}
} else {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned a path \"%s\" that is not in the base directory \"%s\"", ce->name, fname, base);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned a path \"%s\" that is not in the base directory \"%s\"", ce->name, fname, base);
if (save) {
efree(save);
efree(temp);
@ -1462,22 +1488,21 @@ phar_spl_fileinfo:
return ZEND_HASH_APPLY_STOP;
}
PHAR_STR(key, str_key);
if (key_type == HASH_KEY_IS_LONG) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned an invalid key (must return a string)", ce->name);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned an invalid key (must return a string)", ce->name);
return ZEND_HASH_APPLY_STOP;
}
PHAR_STR(key, str_key);
save = str_key;
if (str_key[str_key_len - 1] == '\0') str_key_len--;
} else {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned an invalid key (must return a string)", ce->name);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned an invalid key (must return a string)", ce->name);
return ZEND_HASH_APPLY_STOP;
}
}
#if PHP_MAJOR_VERSION < 6
if (PG(safe_mode) && (!php_checkuid(fname, NULL, CHECKUID_ALLOW_ONLY_FILE))) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned a path \"%s\" that safe mode prevents opening", ce->name, fname);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned a path \"%s\" that safe mode prevents opening", ce->name, fname);
if (save) {
efree(save);
}
@ -1489,7 +1514,7 @@ phar_spl_fileinfo:
#endif
if (php_check_open_basedir(fname TSRMLS_CC)) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned a path \"%s\" that open_basedir prevents opening", ce->name, fname);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned a path \"%s\" that open_basedir prevents opening", ce->name, fname);
if (save) {
efree(save);
}
@ -1502,7 +1527,7 @@ phar_spl_fileinfo:
/* try to open source file, then create internal phar file and copy contents */
fp = php_stream_open_wrapper(fname, "rb", STREAM_MUST_SEEK|0, &opened);
if (!fp) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned a file that could not be opened \"%s\"", ce->name, fname);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned a file that could not be opened \"%s\"", ce->name, fname);
if (save) {
efree(save);
}
@ -3789,6 +3814,11 @@ PHP_METHOD(Phar, extractTo)
switch (Z_TYPE_P(zval_files)) {
case IS_NULL:
goto all_files;
#if PHP_VERSION_ID >= 60000
case IS_UNICODE:
zval_unicode_to_string(zval_files TSRMLS_CC);
/* break intentionally omitted */
#endif
case IS_STRING:
filename = Z_STRVAL_P(zval_files);
filename_len = Z_STRLEN_P(zval_files);
@ -3802,6 +3832,11 @@ PHP_METHOD(Phar, extractTo)
zval **zval_file;
if (zend_hash_index_find(Z_ARRVAL_P(zval_files), i, (void **) &zval_file) == SUCCESS) {
switch (Z_TYPE_PP(zval_file)) {
#if PHP_VERSION_ID >= 60000
case IS_UNICODE:
zval_unicode_to_string(*(zval_file) TSRMLS_CC);
/* break intentionally omitted */
#endif
case IS_STRING:
break;
default:

View file

@ -114,15 +114,15 @@ class Extract_Phar
{
$fp = fopen(__FILE__, 'rb');
fseek($fp, self::LEN);
$L = unpack('V', $a = fread($fp, 4));
$m = '';
$L = unpack('V', $a = (binary)fread($fp, 4));
$m = (binary)'';
do {
$read = 8192;
if ($L[1] - strlen($m) < 8192) {
$read = $L[1] - strlen($m);
}
$last = fread($fp, $read);
$last = (binary)fread($fp, $read);
$m .= $last;
} while (strlen($last) && strlen($m) < $L[1]);

View file

@ -24,10 +24,11 @@ static inline void phar_get_stub(const char *index_php, const char *web, size_t
static const char newstub1_0[] = "';\n\nif (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {\nPhar::interceptFileFuncs();\nset_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path());\nPhar::webPhar(null, $web);\ninclude 'phar://' . __FILE__ . '/' . Extract_Phar::START;\nreturn;\n}\n\nif (@(isset($_SERVER['REQUEST_URI']) && isset($_SERVER['REQUEST_METHOD']) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'POST'))) {\nExtract_Phar::go(true);\n$mimes = array(\n'phps' => 2,\n'c' => 'text/plain',\n'cc' => 'text/plain',\n'cpp' => 'text/plain',\n'c++' => 'text/plain',\n'dtd' => 'text/plain',\n'h' => 'text/plain',\n'log' => 'text/plain',\n'rng' => 'text/plain',\n'txt' => 'text/plain',\n'xsd' => 'text/plain',\n'php' => 1,\n'inc' => 1,\n'avi' => 'video/avi',\n'bmp' => 'image/bmp',\n'css' => 'text/css',\n'gif' => 'image/gif',\n'htm' => 'text/html',\n'html' => 'text/html',\n'htmls' => 'text/html',\n'ico' => 'image/x-ico',\n'jpe' => 'image/jpeg',\n'jpg' => 'image/jpeg',\n'jpeg' => 'image/jpeg',\n'js' => 'application/x-javascript',\n'midi' => 'audio/midi',\n'mid' => 'audio/midi',\n'mod' => 'audio/mod',\n'mov' => 'movie/quicktime',\n'mp3' => 'audio/mp3',\n'mpg' => 'video/mpeg',\n'mpeg' => 'video/mpeg',\n'pdf' => 'application/pdf',\n'png' => 'image/png',\n'swf' => 'application/shockwave-flash',\n'tif' => 'image/tiff',\n'tiff' => 'image/tiff',\n'wav' => 'audio/wav',\n'xbm' => 'image/xbm',\n'xml' => 'text/xml',\n);\n\nheader(\"Cache-Control: no-cache, must-revalidate\");\nheader(\"Pragma: no-cache\");\n\n$basename = basename(__FILE__);\nif (!strpos($_SERVER['REQUEST_URI'], $basename)) {\nchdir(Extract_Phar::$temp);\ninclude $web;\nreturn;\n}\n$pt = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $basename) + strlen($basename));\nif (!$pt || $pt == '/') {\n$pt = $web;\nheader('HTTP/1.1 301 Moved Permanently');\nheader('Location: ' . $_SERVER['REQUEST_URI'] . '/' . $pt);\nexit;\n}\n$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);\nif (!$a || strlen(dirname($a)) < strlen(";
static const char newstub1_1[] = "Extract_Phar::$temp)) {\nheader('HTTP/1.0 404 Not Found');\necho \"<html>\\n <head>\\n <title>File Not Found<title>\\n </head>\\n <body>\\n <h1>404 - File \", $pt, \" Not Found</h1>\\n </body>\\n</html>\";\nexit;\n}\n$b = pathinfo($a);\nif (!isset($b['extension'])) {\nheader('Content-Type: text/plain');\nheader('Content-Length: ' . filesize($a));\nreadfile($a);\nexit;\n}\nif (isset($mimes[$b['extension']])) {\nif ($mimes[$b['extension']] === 1) {\ninclude $a;\nexit;\n}\nif ($mimes[$b['extension']] === 2) {\nhighlight_file($a);\nexit;\n}\nheader('Content-Type: ' .$mimes[$b['extension']]);\nheader('Content-Length: ' . filesize($a));\nreadfile($a);\nexit;\n}\n}\n\nclass Extract_Phar\n{\nstatic $temp;\nstatic $origdir;\nconst GZ = 0x1000;\nconst BZ2 = 0x2000;\nconst MASK = 0x3000;\nconst START = '";
static const char newstub2[] = "';\nconst LEN = ";
static const char newstub3_0[] = ";\n\nstatic function go($return = false)\n{\n$fp = fopen(__FILE__, 'rb');\nfseek($fp, self::LEN);\n$L = unpack('V', $a = fread($fp, 4));\n$m = '';\n\ndo {\n$read = 8192;\nif ($L[1] - strlen($m) < 8192) {\n$read = $L[1] - strlen($m);\n}\n$last = fread($fp, $read);\n$m .= $last;\n} while (strlen($last) && strlen($m) < $L[1]);\n\nif (strlen($m) < $L[1]) {\ndie('ERROR: manifest length read was \"' .\nstrlen($m) .'\" should be \"' .\n$L[1] . '\"');\n}\n\n$info = self::_unpack($m);\n$f = $info['c'];\n\nif ($f & self::GZ) {\nif (!function_exists('gzinflate')) {\ndie('Error: zlib extension is not enabled -' .\n' gzinflate() function needed for zlib-compressed .phars');\n}\n}\n\nif ($f & self::BZ2) {\nif (!function_exists('bzdecompress')) {\ndie('Error: bzip2 extension is not enabled -' .\n' bzdecompress() function needed for bz2-compressed .phars');\n}\n}\n\n$temp = self::tmpdir();\n\nif (!$temp || !is_writable($temp)) {\n$sessionpath = session_save_path();\nif (strpos ($sessionpath, \";\") !== false)\n$sessionpath = substr ($sessionpath, strpos ($sessionpath, \";\")+1);\nif (!file_exists($sessionpath) || !is_dir($sessionpath)) {\ndie('Could not locate temporary directory to extract phar');\n}\n$temp = $sessionpath;\n}\n\n$temp .= '/pharextract/'.basename(__FILE__, '.phar');\nself::$temp = $temp;\nself::$origdir = getcwd();\n@mkdir($temp, 0777, true);\n$temp = realpath($temp);\n\nif (!file_exists($temp . DIRECTORY_SEPARATOR . md5_file(__FILE__))) {\nself::_removeTmpFiles($temp, getcwd());\n@mkdir($temp, 0777, true);\n@file_put_contents($temp . '/' . md5_file(__FILE__), '');\n\nforeach ($info['m'] as $path => $file) {\n$a = !file_exists(dirname($temp . '/' . $path));\n@mkdir(dirname($temp . '/' . $path), 0777, true);\nclearstatcache();\n\nif ($path[strlen($path) - 1] == '/') {\n@mkdir($temp . '/' . $path, 0777);\n} else {\nfile_put_contents($temp . '/' . $path, self::extractFile($path, $file, $fp));\n@chmod($temp . '/' . $path, 0666);\n}\n}\n}\n\nchdir($temp);\n\nif (!$return) {\ninclude self::START;\n}\n}\n\nstatic fun";
static const char newstub3_1[] = "ction tmpdir()\n{\nif (strpos(PHP_OS, 'WIN') !== false) {\nif ($var = getenv('TMP') ? getenv('TMP') : getenv('TEMP')) {\nreturn $var;\n}\nif (is_dir('/temp') || mkdir('/temp')) {\nreturn realpath('/temp');\n}\nreturn false;\n}\nif ($var = getenv('TMPDIR')) {\nreturn $var;\n}\nreturn realpath('/tmp');\n}\n\nstatic function _unpack($m)\n{\n$info = unpack('V', substr($m, 0, 4));\n $l = unpack('V', substr($m, 10, 4));\n$m = substr($m, 14 + $l[1]);\n$s = unpack('V', substr($m, 0, 4));\n$o = 0;\n$start = 4 + $s[1];\n$ret['c'] = 0;\n\nfor ($i = 0; $i < $info[1]; $i++) {\n $len = unpack('V', substr($m, $start, 4));\n$start += 4;\n $savepath = substr($m, $start, $len[1]);\n$start += $len[1];\n $ret['m'][$savepath] = array_values(unpack('Va/Vb/Vc/Vd/Ve/Vf', substr($m, $start, 24)));\n$ret['m'][$savepath][3] = sprintf('%u', $ret['m'][$savepath][3]\n& 0xffffffff);\n$ret['m'][$savepath][7] = $o;\n$o += $ret['m'][$savepath][2];\n$start += 24 + $ret['m'][$savepath][5];\n$ret['c'] |= $ret['m'][$savepath][4] & self::MASK;\n}\nreturn $ret;\n}\n\nstatic function extractFile($path, $entry, $fp)\n{\n$data = '';\n$c = $entry[2];\n\nwhile ($c) {\nif ($c < 8192) {\n$data .= @fread($fp, $c);\n$c = 0;\n} else {\n$c -= 8192;\n$data .= @fread($fp, 8192);\n}\n}\n\nif ($entry[4] & self::GZ) {\n$data = gzinflate($data);\n} elseif ($entry[4] & self::BZ2) {\n$data = bzdecompress($data);\n}\n\nif (strlen($data) != $entry[0]) {\ndie(\"Invalid internal .phar file (size error \" . strlen($data) . \" != \" .\n$stat[7] . \")\");\n}\n\nif ($entry[3] != sprintf(\"%u\", crc32((binary)$data) & 0xffffffff)) {\ndie(\"Invalid internal .phar file (checksum error)\");\n}\n\nreturn $data;\n}\n\nstatic function _removeTmpFiles($temp, $origdir)\n{\nchdir($temp);\n\nforeach (glob('*') as $f) {\nif (file_exists($f)) {\nis_dir($f) ? @rmdir($f) : @unlink($f);\nif (file_exists($f) && is_dir($f)) {\nself::_removeTmpFiles($f, getcwd());\n}\n}\n}\n\n@rmdir($temp);\nclearstatcache();\nchdir($origdir);\n}\n}\n\nExtract_Phar::go();\n__HALT_COMPILER(); ?>";
static const char newstub3_0[] = ";\n\nstatic function go($return = false)\n{\n$fp = fopen(__FILE__, 'rb');\nfseek($fp, self::LEN);\n$L = unpack('V', $a = (binary)fread($fp, 4));\n$m = (binary)'';\n\ndo {\n$read = 8192;\nif ($L[1] - strlen($m) < 8192) {\n$read = $L[1] - strlen($m);\n}\n$last = (binary)fread($fp, $read);\n$m .= $last;\n} while (strlen($last) && strlen($m) < $L[1]);\n\nif (strlen($m) < $L[1]) {\ndie('ERROR: manifest length read was \"' .\nstrlen($m) .'\" should be \"' .\n$L[1] . '\"');\n}\n\n$info = self::_unpack($m);\n$f = $info['c'];\n\nif ($f & self::GZ) {\nif (!function_exists('gzinflate')) {\ndie('Error: zlib extension is not enabled -' .\n' gzinflate() function needed for zlib-compressed .phars');\n}\n}\n\nif ($f & self::BZ2) {\nif (!function_exists('bzdecompress')) {\ndie('Error: bzip2 extension is not enabled -' .\n' bzdecompress() function needed for bz2-compressed .phars');\n}\n}\n\n$temp = self::tmpdir();\n\nif (!$temp || !is_writable($temp)) {\n$sessionpath = session_save_path();\nif (strpos ($sessionpath, \";\") !== false)\n$sessionpath = substr ($sessionpath, strpos ($sessionpath, \";\")+1);\nif (!file_exists($sessionpath) || !is_dir($sessionpath)) {\ndie('Could not locate temporary directory to extract phar');\n}\n$temp = $sessionpath;\n}\n\n$temp .= '/pharextract/'.basename(__FILE__, '.phar');\nself::$temp = $temp;\nself::$origdir = getcwd();\n@mkdir($temp, 0777, true);\n$temp = realpath($temp);\n\nif (!file_exists($temp . DIRECTORY_SEPARATOR . md5_file(__FILE__))) {\nself::_removeTmpFiles($temp, getcwd());\n@mkdir($temp, 0777, true);\n@file_put_contents($temp . '/' . md5_file(__FILE__), '');\n\nforeach ($info['m'] as $path => $file) {\n$a = !file_exists(dirname($temp . '/' . $path));\n@mkdir(dirname($temp . '/' . $path), 0777, true);\nclearstatcache();\n\nif ($path[strlen($path) - 1] == '/') {\n@mkdir($temp . '/' . $path, 0777);\n} else {\nfile_put_contents($temp . '/' . $path, self::extractFile($path, $file, $fp));\n@chmod($temp . '/' . $path, 0666);\n}\n}\n}\n\nchdir($temp);\n\nif (!$return) {\ninclude self::ST";
static const char newstub3_1[] = "ART;\n}\n}\n\nstatic function tmpdir()\n{\nif (strpos(PHP_OS, 'WIN') !== false) {\nif ($var = getenv('TMP') ? getenv('TMP') : getenv('TEMP')) {\nreturn $var;\n}\nif (is_dir('/temp') || mkdir('/temp')) {\nreturn realpath('/temp');\n}\nreturn false;\n}\nif ($var = getenv('TMPDIR')) {\nreturn $var;\n}\nreturn realpath('/tmp');\n}\n\nstatic function _unpack($m)\n{\n$info = unpack('V', substr($m, 0, 4));\n $l = unpack('V', substr($m, 10, 4));\n$m = substr($m, 14 + $l[1]);\n$s = unpack('V', substr($m, 0, 4));\n$o = 0;\n$start = 4 + $s[1];\n$ret['c'] = 0;\n\nfor ($i = 0; $i < $info[1]; $i++) {\n $len = unpack('V', substr($m, $start, 4));\n$start += 4;\n $savepath = substr($m, $start, $len[1]);\n$start += $len[1];\n $ret['m'][$savepath] = array_values(unpack('Va/Vb/Vc/Vd/Ve/Vf', substr($m, $start, 24)));\n$ret['m'][$savepath][3] = sprintf('%u', $ret['m'][$savepath][3]\n& 0xffffffff);\n$ret['m'][$savepath][7] = $o;\n$o += $ret['m'][$savepath][2];\n$start += 24 + $ret['m'][$savepath][5];\n$ret['c'] |= $ret['m'][$savepath][4] & self::MASK;\n}\nreturn $ret;\n}\n\nstatic function extractFile($path, $entry, $fp)\n{\n$data = '';\n$c = $entry[2];\n\nwhile ($c) {\nif ($c < 8192) {\n$data .= @fread($fp, $c);\n$c = 0;\n} else {\n$c -= 8192;\n$data .= @fread($fp, 8192);\n}\n}\n\nif ($entry[4] & self::GZ) {\n$data = gzinflate($data);\n} elseif ($entry[4] & self::BZ2) {\n$data = bzdecompress($data);\n}\n\nif (strlen($data) != $entry[0]) {\ndie(\"Invalid internal .phar file (size error \" . strlen($data) . \" != \" .\n$stat[7] . \")\");\n}\n\nif ($entry[3] != sprintf(\"%u\", crc32((binary)$data) & 0xffffffff)) {\ndie(\"Invalid internal .phar file (checksum error)\");\n}\n\nreturn $data;\n}\n\nstatic function _removeTmpFiles($temp, $origdir)\n{\nchdir($temp);\n\nforeach (glob('*') as $f) {\nif (file_exists($f)) {\nis_dir($f) ? @rmdir($f) : @unlink($f);\nif (file_exists($f) && is_dir($f)) {\nself::_removeTmpFiles($f, getcwd());\n}\n}\n}\n\n@rmdir($temp);\nclearstatcache();\nchdir($origdir);\n}\n}\n\nExtract_Phar::go();\n__HALT_COMPIL";
static const char newstub3_2[] = "ER(); ?>";
static const int newstub_len = 6641;
static const int newstub_len = 6665;
*len = spprintf(stub, name_len + web_len + newstub_len, "%s%s%s%s%s%s%d%s%s", newstub0, web, newstub1_0, newstub1_1, index_php, newstub2, name_len + web_len + newstub_len, newstub3_0, newstub3_1);
*len = spprintf(stub, name_len + web_len + newstub_len, "%s%s%s%s%s%s%d%s%s%s", newstub0, web, newstub1_0, newstub1_1, index_php, newstub2, name_len + web_len + newstub_len, newstub3_0, newstub3_1, newstub3_2);
}

View file

@ -4,10 +4,10 @@ Phar::mapPhar truncated manifest (not enough for manifest length)
<?php if (!extension_loaded("phar")) die("skip");?>
--FILE--
<?php
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$file .= pack('V', 500) . 'notenough';
$file .= pack('V', 500) . (binary)'notenough';
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
try {
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';

View file

@ -6,10 +6,10 @@ Phar::mapPhar too many manifest entries
phar.require_hash=0
--FILE--
<?php
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$file .= pack('VVnVVV', 500, 500, 0x1000, 0x00000000, 0, 0) . str_repeat('A', 500);
$file .= pack('VVnVVV', 500, 500, 0x1000, 0x00000000, 0, 0) . (binary)str_repeat('A', 500);
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
try {
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';

View file

@ -6,14 +6,14 @@ Phar::mapPhar buffer overrun
phar.require_hash=0
--FILE--
<?php
$file = "<?php
$file = (binary)"<?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((binary)''), 0x00000000, 0);
$file .= pack('VVnVV', strlen($manifest), 1, 0x1000, 0x00000000, 3) . 'hio' . pack('V', 0) . $manifest;
$manifest = pack('V', 1) . (binary)'a' . pack('VVVVVV', 0, time(), 0, crc32((binary)''), 0x00000000, 0);
$file .= pack('VVnVV', strlen($manifest), 1, 0x1000, 0x00000000, 3) . (binary)'hio' . pack('V', 0) . (binary)$manifest;
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
try {

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";

View file

@ -9,7 +9,7 @@ phar.require_hash=0
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
// filesize should be 1, and is 2
$files = array();

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
// wrong crc32
$files = array();

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont'=>'a','comp'=>chr(75) . chr(4) . chr(0) /* 'a' gzdeflated */, 'flags'=>0x00001000);

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont'=>'Hello World', 'comp'=>pack('H*', '425a6834314159265359065c89da0000009780400000400080060490002000310c082031a916c41d41e2ee48a70a1200cb913b40'),'flags'=>0x00002000);

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
// file length is too short
$files = array();

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
// file length is too short
$files = array();

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
@ -19,10 +19,12 @@ include 'files/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'); ?>

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";

View file

@ -2,13 +2,14 @@
Phar: opendir test, recurse into
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?php if (!version_compare(phpversion(), 6, '<')) die("skip: permanent loop FIXME"); ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";

View file

@ -2,13 +2,14 @@
Phar: opendir test, recurse into
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?php if (!version_compare(phpversion(), 6, '<')) die("skip: permanent loop FIXME"); ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
@ -53,31 +53,31 @@ array(26) {
int(-1)
[12]=>
int(-1)
["dev"]=>
[u"dev"]=>
int(12)
["ino"]=>
[u"ino"]=>
int(%d)
["mode"]=>
[u"mode"]=>
int(33060)
["nlink"]=>
[u"nlink"]=>
int(1)
["uid"]=>
[u"uid"]=>
int(0)
["gid"]=>
[u"gid"]=>
int(0)
["rdev"]=>
[u"rdev"]=>
int(-1)
["size"]=>
[u"size"]=>
int(1)
["atime"]=>
[u"atime"]=>
int(%d)
["mtime"]=>
[u"mtime"]=>
int(%d)
["ctime"]=>
[u"ctime"]=>
int(%d)
["blksize"]=>
[u"blksize"]=>
int(-1)
["blocks"]=>
[u"blocks"]=>
int(-1)
}
array(26) {
@ -107,30 +107,30 @@ array(26) {
int(-1)
[12]=>
int(-1)
["dev"]=>
[u"dev"]=>
int(12)
["ino"]=>
[u"ino"]=>
int(%d)
["mode"]=>
[u"mode"]=>
int(16749)
["nlink"]=>
[u"nlink"]=>
int(1)
["uid"]=>
[u"uid"]=>
int(0)
["gid"]=>
[u"gid"]=>
int(0)
["rdev"]=>
[u"rdev"]=>
int(-1)
["size"]=>
[u"size"]=>
int(0)
["atime"]=>
[u"atime"]=>
int(%d)
["mtime"]=>
[u"mtime"]=>
int(%d)
["ctime"]=>
[u"ctime"]=>
int(%d)
["blksize"]=>
[u"blksize"]=>
int(-1)
["blocks"]=>
[u"blocks"]=>
int(-1)
}

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
@ -56,30 +56,30 @@ array(26) {
int(-1)
[12]=>
int(-1)
["dev"]=>
[u"dev"]=>
int(12)
["ino"]=>
[u"ino"]=>
int(%d)
["mode"]=>
[u"mode"]=>
int(33060)
["nlink"]=>
[u"nlink"]=>
int(1)
["uid"]=>
[u"uid"]=>
int(0)
["gid"]=>
[u"gid"]=>
int(0)
["rdev"]=>
[u"rdev"]=>
int(-1)
["size"]=>
[u"size"]=>
int(1)
["atime"]=>
[u"atime"]=>
int(%d)
["mtime"]=>
[u"mtime"]=>
int(%d)
["ctime"]=>
[u"ctime"]=>
int(%d)
["blksize"]=>
[u"blksize"]=>
int(-1)
["blocks"]=>
[u"blocks"]=>
int(-1)
}

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = '<?php echo "This is a\n"; ?>';

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; require \''.$pname.'/b.php\'; ?>';

View file

@ -2,13 +2,14 @@
Phar: phar:// opendir
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?php if (!version_compare(phpversion(), 6, '<')) die("skip: permanent loop FIXME"); ?>
--INI--
phar.require_hash=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; require \''.$pname.'/b.php\'; ?>';

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$file = (binary)'<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$alias = '';
$files = array();

View file

@ -11,7 +11,7 @@ $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.php';
$fname = $fname1;
$alias = '';
$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$file = (binary)'<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$file = (binary)'<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; include \''.$pname.'/b.php\'; ?>';

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$file = (binary)'<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$file = (binary)'<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';

View file

@ -134,35 +134,35 @@ echo $e->getMessage() . "\n";
?>
===DONE===
--EXPECTF--
Warning: Phar::mungServer() expects parameter 1 to be array, string given in %sbadparameters.php on line %d
Warning: Phar::mungServer() expects parameter 1 to be array, Unicode string given in %sbadparameters.php on line %d
Warning: Phar::createDefaultStub() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::createDefaultStub() expects parameter 1 to be binary string, array given in %sbadparameters.php on line %d
Warning: Phar::loadPhar() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::loadPhar() expects parameter 1 to be binary string, array given in %sbadparameters.php on line %d
Warning: Phar::canCompress() expects parameter 1 to be long, string given in %sbadparameters.php on line %d
Warning: Phar::canCompress() expects parameter 1 to be long, Unicode string given in %sbadparameters.php on line %d
Warning: Phar::__construct() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::__construct() expects parameter 1 to be binary string, array given in %sbadparameters.php on line %d
Warning: Phar::convertToExecutable() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
Warning: Phar::convertToData() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
Warning: PharData::delete() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: PharData::delete() expects parameter 1 to be binary string, array given in %sbadparameters.php on line %d
Cannot write out phar archive, phar is read-only
Entry oops does not exist and cannot be deleted
%sfiles/frontcontroller10.phar
Cannot write out phar archive, phar is read-only
A Phar alias cannot be set in a plain tar archive
Warning: Phar::setAlias() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::setAlias() expects parameter 1 to be binary string, array given in %sbadparameters.php on line %d
Cannot change stub, phar is read-only
A Phar stub cannot be set in a plain tar archive
Warning: Phar::setStub() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::setStub() expects parameter 1 to be binary string, array given in %sbadparameters.php on line %d
A Phar stub cannot be set in a plain tar archive
Warning: Phar::setDefaultStub() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::setDefaultStub() expects parameter 1 to be binary string, array given in %sbadparameters.php on line %d
Cannot change stub: phar.readonly=1
Cannot set signature algorithm, phar is read-only
Cannot set signature algorithm, not possible with tar-based phar archives
@ -177,18 +177,18 @@ Phar is readonly, cannot change compression
Warning: Phar::copy() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
Cannot copy "a" to "b", phar is read-only
Warning: Phar::offsetExists() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::offsetExists() expects parameter 1 to be binary string, array given in %sbadparameters.php on line %d
Warning: Phar::offsetGet() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::offsetGet() expects parameter 1 to be binary string, array given in %sbadparameters.php on line %d
Warning: Phar::offsetSet() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
Warning: PharData::offsetUnset() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: PharData::offsetUnset() expects parameter 1 to be binary string, array given in %sbadparameters.php on line %d
Write operations disabled by INI setting
Warning: Phar::addEmptyDir() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::addEmptyDir() expects parameter 1 to be binary string, array given in %sbadparameters.php on line %d
Warning: Phar::addFile() expects parameter 1 to be string, array given in %sbadparameters.php on line %d
Warning: Phar::addFile() expects parameter 1 to be binary string, array given in %sbadparameters.php on line %d
Warning: Phar::addFromString() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
Write operations disabled by INI setting

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php
$file = (binary)"<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';

View file

@ -37,7 +37,7 @@ mkdir('phar://' . dirname(__FILE__) . '/ok.phar/fails');
file_put_contents('phar://' . dirname(__FILE__) . '/ok.phar/sub/directory.txt', 'hi');
mkdir('phar://' . dirname(__FILE__) . '/ok.phar/sub');
mkdir('phar://' . dirname(__FILE__) . '/ok.phar/sub/directory.txt');
file_put_contents(dirname(__FILE__) . '/oops.phar', '<?php this should screw em up __HALT_COMPILER();');
file_put_contents(dirname(__FILE__) . '/oops.phar', (binary)'<?php this should screw em up __HALT_COMPILER();');
mkdir('phar://' . dirname(__FILE__) . '/oops.phar/fails');
mkdir('phar://');
@ -72,7 +72,7 @@ Warning: mkdir(): phar error: cannot create directory "fails" in phar "%sok.phar
Warning: mkdir(): phar error: cannot create directory "sub" in phar "%sok.phar", directory already exists in %sdir.php on line %d
Warning: mkdir(): phar error: cannot create directory "sub/directory.txt" in phar "%sok.phar", phar error: path "sub/directory.txt" exists and is a not a directory in %sdir.php on line %d
Warning: mkdir(): phar error: cannot create directory "sub/directory.txt" in phar "%sok.phar", phar error: path "sub/directory.txt" exists and is not a directory in %sdir.php on line %d
Warning: mkdir(): internal corruption of phar "%soops.phar" (truncated manifest at stub end) in %sdir.php on line %d

View file

@ -27,7 +27,6 @@ echo file_get_contents("foob", true);
echo file_get_contents("./hi", 0, $context);
echo file_get_contents("../oops");
echo file_get_contents("./hi", 0, $context, 50000);
ini_set("magic_quotes_runtime", 1);
echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0);
?>
@ -40,7 +39,9 @@ include $pname . '/foo/hi';
<?php rmdir(dirname(__FILE__) . '/poo'); ?>
<?php unlink(dirname(__FILE__) . '/foob'); ?>
--EXPECTF--
Warning: file_get_contents() expects parameter 1 to be string, array given in %sfgc_edgecases.php on line %d
Notice: Array to string conversion in %sfgc_edgecases.php on line %d
Warning: file_get_contents(Array): failed to open stream: No such file or directory in %sfgc_edgecases.php on line %d
blah
<?php
echo file_get_contents("foo/" . basename(__FILE__));
@ -52,7 +53,6 @@ echo file_get_contents("foob", true);
echo file_get_contents("./hi", 0, $context);
echo file_get_contents("../oops");
echo file_get_contents("./hi", 0, $context, 50000);
ini_set("magic_quotes_runtime", 1);
echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0);
?>
@ -70,7 +70,6 @@ echo file_get_contents("foob", true);
echo file_get_contents("./hi", 0, $context);
echo file_get_contents("../oops");
echo file_get_contents("./hi", 0, $context, 50000);
ini_set("magic_quotes_runtime", 1);
echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0);
?>
@ -79,17 +78,16 @@ Warning: file_get_contents(phar://%sfgc_edgecases.phar.php/oops): failed to open
Warning: file_get_contents(): Failed to seek to position 50000 in the stream in phar://%sfgc_edgecases.phar.php/foo/hi on line %d
<?php
echo file_get_contents(\"foo/\" . basename(__FILE__));
echo file_get_contents("foo/" . basename(__FILE__));
$context = stream_context_create();
file_get_contents(\"./hi\", 0, $context, 0, -1);
echo file_get_contents(\"foob\");
set_include_path(\"%stests\");
echo file_get_contents(\"foob\", true);
echo file_get_contents(\"./hi\", 0, $context);
echo file_get_contents(\"../oops\");
echo file_get_contents(\"./hi\", 0, $context, 50000);
ini_set(\"magic_quotes_runtime\", 1);
echo file_get_contents(\"./hi\");
echo file_get_contents(\"./hi\", 0, $context, 0, 0);
file_get_contents("./hi", 0, $context, 0, -1);
echo file_get_contents("foob");
set_include_path("%stests");
echo file_get_contents("foob", true);
echo file_get_contents("./hi", 0, $context);
echo file_get_contents("../oops");
echo file_get_contents("./hi", 0, $context, 50000);
echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0);
?>
===DONE===

Binary file not shown.

View file

@ -4,7 +4,7 @@ ini_set('date.timezone', 'GMT');
$fname = dirname(__FILE__) . '/phar_oo_test.phar.php';
$pname = 'phar://' . $fname;
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$file = (binary)'<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();

View file

@ -4,7 +4,7 @@ if (function_exists('date_default_timezone_set')) {
date_default_timezone_set('UTC');
}
$manifest = '';
$manifest = (binary)'';
$glags = 0;
foreach($files as $name => $cont)
@ -40,8 +40,8 @@ foreach($files as $name => $cont)
if (isset($meta)) $meta = serialize($meta);
// write manifest entry
$manifest .= pack('V', strlen($name)) . $name;
$manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . $meta;
$manifest .= pack('V', strlen($name)) . (binary)$name;
$manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta;
// globals
$gflags |= $flags;
@ -51,12 +51,14 @@ foreach($files as $name => $cont)
if (!isset($alias)) $alias = 'hio';
if (isset($pmeta)) $pmeta = serialize($pmeta); else $pmeta = '';
$manifest = pack('VnVV', count($files), isset($hasdir) ? 0x1110 : 0x1000, $gflags, strlen($alias)) . $alias . pack('V', strlen($pmeta)) . $pmeta . $manifest;
$manifest = pack('VnVV', count($files), isset($hasdir) ? 0x1110 : 0x1000, $gflags, strlen($alias)) . (binary)$alias . pack('V', strlen($pmeta)) . (binary)$pmeta . $manifest;
$file = (binary)$file;
$file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
$file .= $cont;
$file .= (binary)$cont;
}
file_put_contents($fname, $file);

View file

@ -35,7 +35,9 @@ include $pname . '/foo/hi';
<?php rmdir(dirname(__FILE__) . '/poo'); ?>
<?php unlink(dirname(__FILE__) . '/foob'); ?>
--EXPECTF--
Warning: fopen() expects parameter 1 to be string, array given in %sfopen_edgecases2.php on line %d
Notice: Array to string conversion in %sfopen_edgecases2.php on line %d
Warning: fopen(Array): failed to open stream: No such file or directory in %sfopen_edgecases2.php on line %d
blah
test

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller rewrite access denied
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/hi
--FILE_EXTERNAL--
files/frontcontroller4.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
Status: 403 Access Denied
--EXPECT--
<html>

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type extension is not a string
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller5.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught exception 'PharException' with message 'Key of MIME type overrides array must be a file extension, was "0"' in %sfrontcontroller11.php:2
Stack trace:

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type unknown int
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller6.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught exception 'PharException' with message 'Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed' in %sfrontcontroller12.php:2
Stack trace:

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type not string/int
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller7.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Uncaught exception 'PharException' with message 'Unknown mime type specifier used (not a string or int), only Phar::PHP, Phar::PHPS and a mime type string are allowed' in %sfrontcontroller13.php:2
Stack trace:

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type override, Phar::PHPS
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller mime type override, Phar::PHP
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.phps
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
hio1

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller PHP test
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,6 +11,6 @@ PATH_INFO=/a.php
--FILE_EXTERNAL--
files/frontcontroller.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
hio

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller $_SERVER munging success
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -12,7 +12,7 @@ QUERY_STRING=test=hi
--FILE_EXTERNAL--
files/frontcontroller12.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(10) "/index.php"
string(10) "/index.php"

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller include from cwd test 1
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,10 +11,10 @@ PATH_INFO=/index.php
--FILE_EXTERNAL--
files/frontcontroller13.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(4) "test"
string(12) "oof/test.php"
unicode(4) "test"
unicode(12) "oof/test.php"
Warning: include(./hi.php): failed to open stream: No such file or directory in phar://%s/oof/test.php on line %d

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller with generic action router test
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/hi/there
--FILE_EXTERNAL--
files/frontcontroller14.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(9) "/hi/there"
string(%d) "phar://%sfrontcontroller23.php/html/index.php"

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller with custom 404 php script
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,6 +11,6 @@ PATH_INFO=/unknown/file
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
My 404 is rawesome

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller with extra path_info
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a1.phps/extra/stuff
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
string(42) "/frontcontroller25.php/a1.phps/extra/stuff"
string(12) "/extra/stuff"

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller with no extension
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,6 +11,6 @@ PATH_INFO=/noext
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/plain
Content-type: text/plain;charset=UTF-8
--EXPECTF--
hi

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller with fatal error in php file
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,6 +11,6 @@ PATH_INFO=/fatalerror.phps
--FILE_EXTERNAL--
files/frontcontroller8.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECTF--
Fatal error: Call to undefined function oopsie_daisy() in phar://%sfatalerror.phps on line 1

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller phps
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.phps
--FILE_EXTERNAL--
files/frontcontroller.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>

View file

@ -1,14 +1,14 @@
--TEST--
Phar front controller with invalid callback for rewrites
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
SCRIPT_NAME=/frontcontroller31.php
REQUEST_URI=/frontcontroller31.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/frontcontroller16.phar
--EXPECT--

View file

@ -1,14 +1,14 @@
--TEST--
Phar front controller with valid callback that is not good
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
SCRIPT_NAME=/frontcontroller32.php
REQUEST_URI=/frontcontroller32.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/frontcontroller17.phar
--EXPECTF--

View file

@ -1,14 +1,14 @@
--TEST--
Phar front controller with valid callback that does not return any value
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
SCRIPT_NAME=/frontcontroller33.php
REQUEST_URI=/frontcontroller33.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/frontcontroller18.phar
--EXPECTF--

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller with cwd
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -9,7 +9,7 @@ SCRIPT_NAME=/frontcontroller34.php
REQUEST_URI=/frontcontroller34.php/start/index.php
PATH_INFO=/start/index.php
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--FILE_EXTERNAL--
files/frontcontroller19.phar
--EXPECT--

View file

@ -1,7 +1,7 @@
--TEST--
Phar front controller rewrite array
--INI--
default_charset=
default_charset=UTF-8
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV--
@ -11,7 +11,7 @@ PATH_INFO=/hi
--FILE_EXTERNAL--
files/frontcontroller3.phar
--EXPECTHEADERS--
Content-type: text/html
Content-type: text/html; charset=UTF-8
--EXPECT--
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">hio</span><span style="color: #007700">(){}</span>

View file

@ -18,11 +18,11 @@ 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"
unicode(1) "1"
unicode(1) "1"
unicode(1) "1"
unicode(1) "1"
unicode(1) "1"
unicode(1) "1"
unicode(1) "1"
unicode(1) "1"

View file

@ -53,33 +53,33 @@ var_dump(ini_get('phar.readonly'));
?>
===DONE===
--EXPECT--
string(1) "0"
string(1) "0"
string(1) "1"
string(1) "1"
unicode(1) "0"
unicode(1) "0"
unicode(1) "1"
unicode(1) "1"
bool(true)
yes
string(1) "0"
string(1) "0"
string(3) "yes"
string(3) "yes"
unicode(1) "0"
unicode(1) "0"
unicode(3) "yes"
unicode(3) "yes"
bool(false)
on
string(1) "0"
string(1) "0"
string(2) "on"
string(2) "on"
unicode(1) "0"
unicode(1) "0"
unicode(2) "on"
unicode(2) "on"
bool(false)
true
string(1) "0"
string(1) "0"
unicode(1) "0"
unicode(1) "0"
bool(false)
string(4) "true"
string(4) "true"
unicode(4) "true"
unicode(4) "true"
0
string(4) "true"
string(4) "true"
unicode(4) "true"
unicode(4) "true"
bool(true)
string(1) "0"
string(1) "0"
unicode(1) "0"
unicode(1) "0"
===DONE===

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont' => 'a');
@ -41,18 +41,18 @@ string(1) "b"
string(1) "c"
string(1) "d"
NULL
string(8) "hi there"
unicode(8) "hi there"
array(2) {
[0]=>
string(2) "hi"
unicode(2) "hi"
[1]=>
string(5) "there"
unicode(5) "there"
}
array(2) {
["hi"]=>
string(5) "there"
["foo"]=>
string(3) "bar"
[u"hi"]=>
unicode(5) "there"
[u"foo"]=>
unicode(3) "bar"
}
string(1) "a"
string(1) "b"

View file

@ -9,7 +9,7 @@ phar.readonly=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont' => 'a');
@ -51,8 +51,8 @@ NULL
array(2) {
[0]=>
int(25)
["foo"]=>
string(3) "bar"
[u"foo"]=>
unicode(3) "bar"
}
bool(true)
string(1) "a"

View file

@ -9,7 +9,7 @@ phar.readonly=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a'] = array('cont' => 'a');
@ -59,8 +59,8 @@ NULL
array(2) {
[0]=>
int(25)
["foo"]=>
string(3) "bar"
[u"foo"]=>
unicode(3) "bar"
}
bool(true)
string(1) "a"
@ -72,8 +72,8 @@ NULL
array(2) {
[0]=>
int(25)
["foo"]=>
string(3) "bar"
[u"foo"]=>
unicode(3) "bar"
}
bool(true)
===DONE===

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
@ -18,7 +18,7 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
$fp = fopen($pname . '/b/c.php', 'wb');
fwrite($fp, 'extra');
fwrite($fp, (binary)'extra');
fclose($fp);
include $pname . '/b/c.php';
?>

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
@ -24,7 +24,7 @@ function err_handler($errno, $errstr, $errfile, $errline) {
set_error_handler("err_handler", E_RECOVERABLE_ERROR);
$fp = fopen($pname . '/b/c.php', 'wb');
fwrite($fp, 'extra');
fwrite($fp, (binary)'extra');
fclose($fp);
include $pname . '/b/c.php';
?>
@ -32,11 +32,10 @@ include $pname . '/b/c.php';
--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: fwrite() expects parameter 1 to be resource, boolean given in %sopen_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
Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_existing_b.php on line %d
This is b/c
===DONE===

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
@ -18,7 +18,7 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
$fp = fopen($pname . '/b/c.php', 'wb');
fwrite($fp, 'extra');
fwrite($fp, (binary)'extra');
fclose($fp);
include $pname . '/b/c.php';
?>
@ -26,10 +26,9 @@ include $pname . '/b/c.php';
--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: fwrite() expects parameter 1 to be resource, boolean given 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

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
@ -18,7 +18,7 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
$fp = fopen($pname . '/b/new.php', 'wb');
fwrite($fp, 'extra');
fwrite($fp, (binary)'extra');
fclose($fp);
include $pname . '/b/c.php';
include $pname . '/b/new.php';

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
@ -24,7 +24,7 @@ function err_handler($errno, $errstr, $errfile, $errline) {
set_error_handler("err_handler", E_RECOVERABLE_ERROR);
$fp = fopen($pname . '/b/new.php', 'wb');
fwrite($fp, 'extra');
fwrite($fp, (binary)'extra');
fclose($fp);
include $pname . '/b/c.php';
include $pname . '/b/new.php';
@ -34,15 +34,14 @@ include $pname . '/b/new.php';
--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: fwrite() expects parameter 1 to be resource, boolean given 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
Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b.php on line %d
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(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 %d
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

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>";
$file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>';
@ -18,7 +18,7 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
$fp = fopen($pname . '/b/new.php', 'wb');
fwrite($fp, 'extra');
fwrite($fp, (binary)'extra');
fclose($fp);
include $pname . '/b/c.php';
include $pname . '/b/new.php';
@ -28,16 +28,15 @@ include $pname . '/b/new.php';
--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: fwrite() expects parameter 1 to be resource, boolean given 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
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 16
===DONE===

View file

@ -37,7 +37,9 @@ include $pname . '/foo';
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php rmdir(dirname(__FILE__) . '/poo');
--EXPECTF--
Warning: opendir() expects parameter 1 to be string, array given in %sopendir_edgecases.php on line %d
Notice: Array to string conversion in %sopendir_edgecases.php on line %d
Warning: opendir(Array): failed to open dir: No such file or directory in %sopendir_edgecases.php on line %d
.
..
foo

View file

@ -35,16 +35,16 @@ unlink(dirname(__FILE__) . '/brandnewphar.phar');
--EXPECT--
bool(true)
bool(false)
string(5) "Hello"
unicode(5) "Hello"
string(84) "<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
"
string(5) "World"
unicode(5) "World"
string(85) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
"
===COMMIT===
bool(true)
string(5) "Hello"
string(5) "World"
unicode(5) "Hello"
unicode(5) "World"
string(85) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>
"
===DONE===

View file

@ -23,6 +23,6 @@ unlink(dirname(__FILE__) . '/buildfromdirectory.phar');
__HALT_COMPILER();
?>
--EXPECT--
string(24) "UnexpectedValueException"
unicode(24) "UnexpectedValueException"
Cannot write to archive - write operations restricted by INI setting
===DONE===

View file

@ -22,6 +22,6 @@ unlink(dirname(__FILE__) . '/buildfromdirectory.phar');
__HALT_COMPILER();
?>
--EXPECT--
string(24) "UnexpectedValueException"
unicode(24) "UnexpectedValueException"
RecursiveDirectoryIterator::__construct(1): failed to open dir: No such file or directory
===DONE===

View file

@ -23,5 +23,5 @@ unlink(dirname(__FILE__) . '/buildfromiterator.phar');
__HALT_COMPILER();
?>
--EXPECTF--
Warning: Phar::buildFromDirectory() expects parameter 2 to be string, object given in %sphar_buildfromdirectory3.php on line %d
Warning: Phar::buildFromDirectory() expects parameter 2 to be binary string, object given in %sphar_buildfromdirectory3.php on line %d
===DONE===

View file

@ -23,6 +23,6 @@ unlink(dirname(__FILE__) . '/buildfromiterator.phar');
__HALT_COMPILER();
?>
--EXPECT--
string(24) "UnexpectedValueException"
unicode(24) "UnexpectedValueException"
Cannot write out phar archive, phar is read-only
===DONE===

View file

@ -50,5 +50,5 @@ unlink(dirname(__FILE__) . '/buildfromiterator.phar');
__HALT_COMPILER();
?>
--EXPECTF--
Warning: Phar::buildFromIterator() expects parameter 2 to be string, object given in %sphar_buildfromiterator3.php on line %d
Warning: Phar::buildFromIterator() expects parameter 2 to be binary string, object given in %sphar_buildfromiterator3.php on line %d
===DONE===

View file

@ -54,6 +54,6 @@ __HALT_COMPILER();
rewind
valid
current
string(24) "UnexpectedValueException"
unicode(24) "UnexpectedValueException"
Iterator myIterator returned an invalid value (must return a string)
===DONE===

View file

@ -55,6 +55,6 @@ rewind
valid
current
key
string(24) "UnexpectedValueException"
unicode(24) "UnexpectedValueException"
Iterator myIterator returned an invalid key (must return a string)
===DONE===

View file

@ -55,6 +55,6 @@ rewind
valid
current
key
string(24) "UnexpectedValueException"
unicode(24) "UnexpectedValueException"
Iterator myIterator returned a file that could not be opened "phar_buildfromiterator7./oopsie/there.phpt"
===DONE===

View file

@ -14,7 +14,7 @@ $pname = 'phar://' . $fname;
$fname2 = dirname(__FILE__) . '/phar_bz2.2.phar';
$pname2 = 'phar://' . $fname2;
$file = '<?php
$file = (binary)'<?php
Phar::mapPhar();
var_dump("it worked");
include "phar://" . __FILE__ . "/tar_004.php";
@ -53,8 +53,8 @@ echo $e->getMessage(),"\n";
@unlink(dirname(__FILE__) . '/phar_bz2.2.phar');
?>
--EXPECTF--
string(9) "it worked"
string(%d) "phar://%sphar_bz2.phar/tar_004.php"
unicode(9) "it worked"
unicode(%d) "phar://%sphar_bz2.phar/tar_004.php"
bool(true)
bool(true)

View file

@ -29,7 +29,7 @@ unlink(dirname(__FILE__) . '/brandnewphar.phar');
__HALT_COMPILER();
?>
--EXPECT--
int(6659)
int(6683)
string(200) "<?php
function __autoload($class)
{

View file

@ -13,8 +13,7 @@ phar.readonly=0
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '2.tbz';
$pname = 'phar://' . $fname;
$stub = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
$file = $stub;
$file = (binary)'<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
$files = array();
$files['a'] = 'a';

View file

@ -12,8 +12,7 @@ $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
$pname = 'phar://' . $fname;
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
$fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
$stub = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
$file = $stub;
$file = (binary)'<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
$files = array();
$files['a'] = 'a';
@ -123,7 +122,7 @@ NULL
bool(true)
bool(false)
bool(false)
int(6659)
int(6683)
NULL
================= convertToZip() =====================
bool(false)

View file

@ -12,8 +12,7 @@ $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
$pname = 'phar://' . $fname;
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
$fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.tar';
$stub = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
$file = $stub;
$file = (binary)'<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
$files = array();
$files['a'] = 'a';

View file

@ -13,8 +13,7 @@ $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar.gz';
$fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.tar';
$stub = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
$file = $stub;
$file = (binary)'<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
$files = array();
$files['a'] = 'a';

View file

@ -13,8 +13,7 @@ $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
$fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.tar';
$stub = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
$file = $stub;
$file = (binary)'<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
$files = array();
$files['a'] = 'a';

View file

@ -12,8 +12,7 @@ $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
$pname = 'phar://' . $fname;
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
$fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.zip';
$stub = '<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
$file = $stub;
$file = (binary)'<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
$files = array();
$files['a'] = 'a';

View file

@ -32,7 +32,7 @@ __HALT_COMPILER();
unlink(dirname(__FILE__) . '/brandnewphar.phar');
?>
--EXPECT--
int(6659)
int(6683)
string(200) "<?php
function __autoload($class)
{

View file

@ -34,7 +34,7 @@ echo $e->getMessage() . "\n";
?>
===DONE===
--EXPECT--
string(6659) "<?php
string(6683) "<?php
$web = 'index.php';
@ -144,21 +144,21 @@ const GZ = 0x1000;
const BZ2 = 0x2000;
const MASK = 0x3000;
const START = 'index.php';
const LEN = 6661;
const LEN = 6685;
static function go($return = false)
{
$fp = fopen(__FILE__, 'rb');
fseek($fp, self::LEN);
$L = unpack('V', $a = fread($fp, 4));
$m = '';
$L = unpack('V', $a = (binary)fread($fp, 4));
$m = (binary)'';
do {
$read = 8192;
if ($L[1] - strlen($m) < 8192) {
$read = $L[1] - strlen($m);
}
$last = fread($fp, $read);
$last = (binary)fread($fp, $read);
$m .= $last;
} while (strlen($last) && strlen($m) < $L[1]);
@ -328,7 +328,7 @@ Extract_Phar::go();
__HALT_COMPILER(); ?>"
============================================================================
============================================================================
string(6670) "<?php
string(6694) "<?php
$web = 'index.php';
@ -438,21 +438,21 @@ const GZ = 0x1000;
const BZ2 = 0x2000;
const MASK = 0x3000;
const START = 'my/custom/thingy.php';
const LEN = 6672;
const LEN = 6696;
static function go($return = false)
{
$fp = fopen(__FILE__, 'rb');
fseek($fp, self::LEN);
$L = unpack('V', $a = fread($fp, 4));
$m = '';
$L = unpack('V', $a = (binary)fread($fp, 4));
$m = (binary)'';
do {
$read = 8192;
if ($L[1] - strlen($m) < 8192) {
$read = $L[1] - strlen($m);
}
$last = fread($fp, $read);
$last = (binary)fread($fp, $read);
$m .= $last;
} while (strlen($last) && strlen($m) < $L[1]);
@ -622,7 +622,7 @@ Extract_Phar::go();
__HALT_COMPILER(); ?>"
============================================================================
============================================================================
int(7050)
int(7074)
============================================================================
============================================================================
Illegal filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed
@ -630,7 +630,7 @@ Illegal filename passed in for stub creation, was 401 characters long, and only
============================================================================
============================================================================
============================================================================
string(6672) "<?php
string(6696) "<?php
$web = 'the/web.php';
@ -740,21 +740,21 @@ const GZ = 0x1000;
const BZ2 = 0x2000;
const MASK = 0x3000;
const START = 'my/custom/thingy.php';
const LEN = 6674;
const LEN = 6698;
static function go($return = false)
{
$fp = fopen(__FILE__, 'rb');
fseek($fp, self::LEN);
$L = unpack('V', $a = fread($fp, 4));
$m = '';
$L = unpack('V', $a = (binary)fread($fp, 4));
$m = (binary)'';
do {
$read = 8192;
if ($L[1] - strlen($m) < 8192) {
$read = $L[1] - strlen($m);
}
$last = fread($fp, $read);
$last = (binary)fread($fp, $read);
$m .= $last;
} while (strlen($last) && strlen($m) < $L[1]);
@ -924,6 +924,6 @@ Extract_Phar::go();
__HALT_COMPILER(); ?>"
============================================================================
============================================================================
int(7050)
int(7074)
Illegal web filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed
===DONE===

View file

@ -10,7 +10,7 @@ phar.readonly=0
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = '<?php __HALT_COMPILER(); ?>';
$file = (binary)'<?php __HALT_COMPILER(); ?>';
$files = array();
$files['a'] = 'a';
@ -31,9 +31,9 @@ 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);
file_put_contents($pname . '/a', (binary)'new a', 0); // no compression
file_put_contents($pname . '/b', (binary)'new b', 0, $context);
file_put_contents($pname . '/d', (binary)'new d', 0, $context2);
$phar = new Phar($fname);
var_dump(file_get_contents($pname . '/a'));

View file

@ -11,7 +11,7 @@ phar.readonly=0
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '2.phar.gz';
$pname = 'phar://' . $fname;
$file = '<?php __HALT_COMPILER(); ?>';
$file = (binary)'<?php __HALT_COMPILER(); ?>';
$files = array();
$files['a'] = 'a';
@ -63,7 +63,7 @@ int(4096)
%sphar_decompress.phar
%sphar_decompress.hooba.phar
Warning: Phar::decompress() expects parameter 1 to be string, array given in %sphar_decompress.php on line %d
Warning: Phar::decompress() expects parameter 1 to be binary string, array given in %sphar_decompress.php on line %d
Cannot decompress phar archive, phar is read-only
Cannot decompress zip-based archives with whole-archive compression
===DONE===

View file

@ -13,8 +13,7 @@ $dir = dirname(__FILE__) . '/broken.dirname';
mkdir($dir, 0777);
$fname = $dir . '/dotted_path.phar';
$stub = Phar::createDefaultStub();
$file = $stub;
$file = (binary)Phar::createDefaultStub();
$files = array();
$files['a'] = 'this is a';

View file

@ -119,7 +119,7 @@ string(3) "hi2"
bool(false)
Invalid argument, expected a filename (string) or array of filenames
Warning: Phar::extractTo() expects parameter 1 to be string, array given in %sphar_extract.php on line %d
Warning: Phar::extractTo() expects parameter 1 to be binary string, array given in %sphar_extract.php on line %d
Invalid argument, extraction path must be non-zero length
Unable to use path "%soops" for extraction, it is a file, must be a directory
Invalid argument, array of filenames to extract contains non-string value

View file

@ -15,7 +15,7 @@ $pname = 'phar://' . $fname;
$fname2 = dirname(__FILE__) . '/phar_gzip.2.phar';
$pname2 = 'phar://' . $fname2;
$file = '<?php
$file = (binary)'<?php
Phar::mapPhar();
var_dump("it worked");
include "phar://" . __FILE__ . "/tar_004.php";
@ -47,8 +47,8 @@ var_dump($b->isCompressed() == Phar::GZ);
@unlink(dirname(__FILE__) . '/phar_gzip.2.phar');
?>
--EXPECTF--
string(9) "it worked"
string(%d) "phar://%sphar_gzip.phar/tar_004.php"
unicode(9) "it worked"
unicode(%d) "phar://%sphar_gzip.phar/tar_004.php"
bool(true)
bool(true)
===DONE===

Some files were not shown because too many files have changed in this diff Show more