- 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; return;
} }
switch (Z_TYPE_P(retval_ptr)) { 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); efree(entry);
if (fci.retval_ptr_ptr != &retval_ptr) { if (fci.retval_ptr_ptr != &retval_ptr) {
entry = estrndup(Z_STRVAL_PP(fci.retval_ptr_ptr), Z_STRLEN_PP(fci.retval_ptr_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; RETURN_FALSE;
} }
break; 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) PHAR_SET_USER_MIME(PHAR_MIME_OTHER)
break; break;
default : 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()"); zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "unable to retrieve array value in Phar::mungServer()");
return; 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) { 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"); 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; return;
} }
if (!php_self && Z_STRLEN_PP(data) == sizeof("PHP_SELF")-1 && !strncmp(Z_STRVAL_PP(data), "PHP_SELF", sizeof("PHP_SELF")-1)) { 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)) { 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"); 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) { if (!value) {
/* failure in get_current_data */ /* 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; return ZEND_HASH_APPLY_STOP;
} }
switch (Z_TYPE_PP(value)) { 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; break;
case IS_RESOURCE : case IS_RESOURCE:
php_stream_from_zval_no_verify(fp, value); php_stream_from_zval_no_verify(fp, value);
if (!fp) { 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; return ZEND_HASH_APPLY_STOP;
} }
if (iter->funcs->get_current_key) { 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; return ZEND_HASH_APPLY_STOP;
} }
PHAR_STR(key, str_key);
if (key_type == HASH_KEY_IS_LONG) { 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; return ZEND_HASH_APPLY_STOP;
} }
PHAR_STR(key, str_key);
save = str_key; save = str_key;
if (str_key[str_key_len - 1] == '\0') str_key_len--; if (str_key[str_key_len - 1] == '\0') str_key_len--;
} else { } 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; return ZEND_HASH_APPLY_STOP;
} }
close_fp = 0; close_fp = 0;
opened = (char *) estrndup(str, sizeof("[stream]") + 1); opened = (char *) estrndup(str, sizeof("[stream]") + 1);
goto after_open_fp; goto after_open_fp;
case IS_OBJECT : case IS_OBJECT:
if (instanceof_function(Z_OBJCE_PP(value), spl_ce_SplFileInfo TSRMLS_CC)) { if (instanceof_function(Z_OBJCE_PP(value), spl_ce_SplFileInfo TSRMLS_CC)) {
char *test = NULL; char *test = NULL;
zval dummy; zval dummy;
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(*value TSRMLS_CC); spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(*value TSRMLS_CC);
if (!base_len) { 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; return ZEND_HASH_APPLY_STOP;
} }
switch (intern->type) { switch (intern->type) {
@ -1411,7 +1433,11 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
goto phar_spl_fileinfo; goto phar_spl_fileinfo;
case SPL_FS_INFO: case SPL_FS_INFO:
case SPL_FS_FILE: case SPL_FS_FILE:
#if PHP_VERSION_ID >= 60000
fname = expand_filepath(intern->file_name.s, NULL TSRMLS_CC); 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); fname_len = strlen(fname);
save = fname; save = fname;
is_splfileinfo = 1; is_splfileinfo = 1;
@ -1420,7 +1446,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
} }
/* fall-through */ /* fall-through */
default : 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; return ZEND_HASH_APPLY_STOP;
} }
@ -1447,7 +1473,7 @@ phar_spl_fileinfo:
str_key_len--; str_key_len--;
} }
} else { } 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) { if (save) {
efree(save); efree(save);
efree(temp); efree(temp);
@ -1462,22 +1488,21 @@ phar_spl_fileinfo:
return ZEND_HASH_APPLY_STOP; return ZEND_HASH_APPLY_STOP;
} }
PHAR_STR(key, str_key);
if (key_type == HASH_KEY_IS_LONG) { 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; return ZEND_HASH_APPLY_STOP;
} }
PHAR_STR(key, str_key);
save = str_key; save = str_key;
if (str_key[str_key_len - 1] == '\0') str_key_len--; if (str_key[str_key_len - 1] == '\0') str_key_len--;
} else { } 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; return ZEND_HASH_APPLY_STOP;
} }
} }
#if PHP_MAJOR_VERSION < 6 #if PHP_MAJOR_VERSION < 6
if (PG(safe_mode) && (!php_checkuid(fname, NULL, CHECKUID_ALLOW_ONLY_FILE))) { 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) { if (save) {
efree(save); efree(save);
} }
@ -1489,7 +1514,7 @@ phar_spl_fileinfo:
#endif #endif
if (php_check_open_basedir(fname TSRMLS_CC)) { 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) { if (save) {
efree(save); efree(save);
} }
@ -1502,7 +1527,7 @@ phar_spl_fileinfo:
/* try to open source file, then create internal phar file and copy contents */ /* 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); fp = php_stream_open_wrapper(fname, "rb", STREAM_MUST_SEEK|0, &opened);
if (!fp) { 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) { if (save) {
efree(save); efree(save);
} }
@ -3789,6 +3814,11 @@ PHP_METHOD(Phar, extractTo)
switch (Z_TYPE_P(zval_files)) { switch (Z_TYPE_P(zval_files)) {
case IS_NULL: case IS_NULL:
goto all_files; 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: case IS_STRING:
filename = Z_STRVAL_P(zval_files); filename = Z_STRVAL_P(zval_files);
filename_len = Z_STRLEN_P(zval_files); filename_len = Z_STRLEN_P(zval_files);
@ -3802,6 +3832,11 @@ PHP_METHOD(Phar, extractTo)
zval **zval_file; zval **zval_file;
if (zend_hash_index_find(Z_ARRVAL_P(zval_files), i, (void **) &zval_file) == SUCCESS) { if (zend_hash_index_find(Z_ARRVAL_P(zval_files), i, (void **) &zval_file) == SUCCESS) {
switch (Z_TYPE_PP(zval_file)) { 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: case IS_STRING:
break; break;
default: default:

View file

@ -114,15 +114,15 @@ class Extract_Phar
{ {
$fp = fopen(__FILE__, 'rb'); $fp = fopen(__FILE__, 'rb');
fseek($fp, self::LEN); fseek($fp, self::LEN);
$L = unpack('V', $a = fread($fp, 4)); $L = unpack('V', $a = (binary)fread($fp, 4));
$m = ''; $m = (binary)'';
do { do {
$read = 8192; $read = 8192;
if ($L[1] - strlen($m) < 8192) { if ($L[1] - strlen($m) < 8192) {
$read = $L[1] - strlen($m); $read = $L[1] - strlen($m);
} }
$last = fread($fp, $read); $last = (binary)fread($fp, $read);
$m .= $last; $m .= $last;
} while (strlen($last) && strlen($m) < $L[1]); } 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_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 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 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_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[] = "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_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");?> <?php if (!extension_loaded("phar")) die("skip");?>
--FILE-- --FILE--
<?php <?php
$file = "<?php $file = (binary)"<?php
Phar::mapPhar('hio'); Phar::mapPhar('hio');
__HALT_COMPILER(); ?>"; __HALT_COMPILER(); ?>";
$file .= pack('V', 500) . 'notenough'; $file .= pack('V', 500) . (binary)'notenough';
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
try { try {
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';

View file

@ -6,10 +6,10 @@ Phar::mapPhar too many manifest entries
phar.require_hash=0 phar.require_hash=0
--FILE-- --FILE--
<?php <?php
$file = "<?php $file = (binary)"<?php
Phar::mapPhar('hio'); Phar::mapPhar('hio');
__HALT_COMPILER(); ?>"; __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); file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
try { try {
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -8,7 +8,7 @@ phar.require_hash=0
<?php <?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname; $pname = 'phar://' . $fname;
$file = "<?php $file = (binary)"<?php
Phar::mapPhar('hio'); Phar::mapPhar('hio');
__HALT_COMPILER(); ?>"; __HALT_COMPILER(); ?>";
@ -19,10 +19,12 @@ include 'files/phar_test.inc';
include $fname; include $fname;
$dir = opendir('phar://hio/'); $dir = opendir('phar://hio/');
while (false !== ($a = readdir($dir))) { while (false !== ($a = readdir($dir))) {
var_dump($a); var_dump($a);
var_dump(is_dir('phar://hio/' . $a)); var_dump(is_dir('phar://hio/' . $a));
} }
?> ?>
--CLEAN-- --CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -134,35 +134,35 @@ echo $e->getMessage() . "\n";
?> ?>
===DONE=== ===DONE===
--EXPECTF-- --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::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: 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 Cannot write out phar archive, phar is read-only
Entry oops does not exist and cannot be deleted Entry oops does not exist and cannot be deleted
%sfiles/frontcontroller10.phar %sfiles/frontcontroller10.phar
Cannot write out phar archive, phar is read-only Cannot write out phar archive, phar is read-only
A Phar alias cannot be set in a plain tar archive 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 Cannot change stub, phar is read-only
A Phar stub cannot be set in a plain tar archive 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 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 change stub: phar.readonly=1
Cannot set signature algorithm, phar is read-only Cannot set signature algorithm, phar is read-only
Cannot set signature algorithm, not possible with tar-based phar archives 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 Warning: Phar::copy() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
Cannot copy "a" to "b", phar is read-only 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: 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 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 Warning: Phar::addFromString() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
Write operations disabled by INI setting Write operations disabled by INI setting

View file

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

View file

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

View file

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

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php <?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname; $pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>"; $file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array(); $files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>'; $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'); 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');
mkdir('phar://' . dirname(__FILE__) . '/ok.phar/sub/directory.txt'); 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://' . dirname(__FILE__) . '/oops.phar/fails');
mkdir('phar://'); 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" 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 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("./hi", 0, $context);
echo file_get_contents("../oops"); echo file_get_contents("../oops");
echo file_get_contents("./hi", 0, $context, 50000); echo file_get_contents("./hi", 0, $context, 50000);
ini_set("magic_quotes_runtime", 1);
echo file_get_contents("./hi"); echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0); echo file_get_contents("./hi", 0, $context, 0, 0);
?> ?>
@ -40,7 +39,9 @@ include $pname . '/foo/hi';
<?php rmdir(dirname(__FILE__) . '/poo'); ?> <?php rmdir(dirname(__FILE__) . '/poo'); ?>
<?php unlink(dirname(__FILE__) . '/foob'); ?> <?php unlink(dirname(__FILE__) . '/foob'); ?>
--EXPECTF-- --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 blah
<?php <?php
echo file_get_contents("foo/" . basename(__FILE__)); 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("./hi", 0, $context);
echo file_get_contents("../oops"); echo file_get_contents("../oops");
echo file_get_contents("./hi", 0, $context, 50000); echo file_get_contents("./hi", 0, $context, 50000);
ini_set("magic_quotes_runtime", 1);
echo file_get_contents("./hi"); echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0); 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("./hi", 0, $context);
echo file_get_contents("../oops"); echo file_get_contents("../oops");
echo file_get_contents("./hi", 0, $context, 50000); echo file_get_contents("./hi", 0, $context, 50000);
ini_set("magic_quotes_runtime", 1);
echo file_get_contents("./hi"); echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0); 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 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 <?php
echo file_get_contents(\"foo/\" . basename(__FILE__)); echo file_get_contents("foo/" . basename(__FILE__));
$context = stream_context_create(); $context = stream_context_create();
file_get_contents(\"./hi\", 0, $context, 0, -1); file_get_contents("./hi", 0, $context, 0, -1);
echo file_get_contents(\"foob\"); echo file_get_contents("foob");
set_include_path(\"%stests\"); set_include_path("%stests");
echo file_get_contents(\"foob\", true); echo file_get_contents("foob", true);
echo file_get_contents(\"./hi\", 0, $context); echo file_get_contents("./hi", 0, $context);
echo file_get_contents(\"../oops\"); echo file_get_contents("../oops");
echo file_get_contents(\"./hi\", 0, $context, 50000); echo file_get_contents("./hi", 0, $context, 50000);
ini_set(\"magic_quotes_runtime\", 1); echo file_get_contents("./hi");
echo file_get_contents(\"./hi\"); echo file_get_contents("./hi", 0, $context, 0, 0);
echo file_get_contents(\"./hi\", 0, $context, 0, 0);
?> ?>
===DONE=== ===DONE===

Binary file not shown.

View file

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

View file

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

View file

@ -35,7 +35,9 @@ include $pname . '/foo/hi';
<?php rmdir(dirname(__FILE__) . '/poo'); ?> <?php rmdir(dirname(__FILE__) . '/poo'); ?>
<?php unlink(dirname(__FILE__) . '/foob'); ?> <?php unlink(dirname(__FILE__) . '/foob'); ?>
--EXPECTF-- --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 blah
test test

View file

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

View file

@ -1,7 +1,7 @@
--TEST-- --TEST--
Phar front controller mime type extension is not a string Phar front controller mime type extension is not a string
--INI-- --INI--
default_charset= default_charset=UTF-8
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?> <?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV-- --ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL-- --FILE_EXTERNAL--
files/frontcontroller5.phar files/frontcontroller5.phar
--EXPECTHEADERS-- --EXPECTHEADERS--
Content-type: text/html Content-type: text/html; charset=UTF-8
--EXPECTF-- --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 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: Stack trace:

View file

@ -1,7 +1,7 @@
--TEST-- --TEST--
Phar front controller mime type unknown int Phar front controller mime type unknown int
--INI-- --INI--
default_charset= default_charset=UTF-8
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?> <?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV-- --ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL-- --FILE_EXTERNAL--
files/frontcontroller6.phar files/frontcontroller6.phar
--EXPECTHEADERS-- --EXPECTHEADERS--
Content-type: text/html Content-type: text/html; charset=UTF-8
--EXPECTF-- --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 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: Stack trace:

View file

@ -1,7 +1,7 @@
--TEST-- --TEST--
Phar front controller mime type not string/int Phar front controller mime type not string/int
--INI-- --INI--
default_charset= default_charset=UTF-8
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?> <?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV-- --ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.php
--FILE_EXTERNAL-- --FILE_EXTERNAL--
files/frontcontroller7.phar files/frontcontroller7.phar
--EXPECTHEADERS-- --EXPECTHEADERS--
Content-type: text/html Content-type: text/html; charset=UTF-8
--EXPECTF-- --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 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: Stack trace:

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,4 +11,4 @@ files/frontcontroller8.phar
--EXPECTHEADERS-- --EXPECTHEADERS--
Content-type: application/octet-stream Content-type: application/octet-stream
--EXPECTF-- --EXPECTF--
<?php var_dump("hi"); <?php var_dump("hi");

View file

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

File diff suppressed because one or more lines are too long

View file

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

View file

@ -1,7 +1,7 @@
--TEST-- --TEST--
Phar front controller phps Phar front controller phps
--INI-- --INI--
default_charset= default_charset=UTF-8
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?> <?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV-- --ENV--
@ -11,7 +11,7 @@ PATH_INFO=/a.phps
--FILE_EXTERNAL-- --FILE_EXTERNAL--
files/frontcontroller.phar files/frontcontroller.phar
--EXPECTHEADERS-- --EXPECTHEADERS--
Content-type: text/html Content-type: text/html; charset=UTF-8
--EXPECT-- --EXPECT--
<code><span style="color: #000000"> <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> <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

@ -9,4 +9,4 @@ REQUEST_URI=/huh?
files/frontcontroller8.phar files/frontcontroller8.phar
--EXPECTF-- --EXPECTF--
oops did not run oops did not run
%a %a

View file

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

View file

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

View file

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

View file

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

View file

@ -18,4 +18,4 @@ Status: 404 Not Found
<body> <body>
<h1>404 - File /notfound.php Not Found</h1> <h1>404 - File /notfound.php Not Found</h1>
</body> </body>
</html> </html>

View file

@ -18,4 +18,4 @@ Status: 404 Not Found
<body> <body>
<h1>404 - File /index.php Not Found</h1> <h1>404 - File /index.php Not Found</h1>
</body> </body>
</html> </html>

View file

@ -1,7 +1,7 @@
--TEST-- --TEST--
Phar front controller rewrite array Phar front controller rewrite array
--INI-- --INI--
default_charset= default_charset=UTF-8
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?> <?php if (!extension_loaded("phar")) die("skip"); ?>
--ENV-- --ENV--
@ -11,9 +11,9 @@ PATH_INFO=/hi
--FILE_EXTERNAL-- --FILE_EXTERNAL--
files/frontcontroller3.phar files/frontcontroller3.phar
--EXPECTHEADERS-- --EXPECTHEADERS--
Content-type: text/html Content-type: text/html; charset=UTF-8
--EXPECT-- --EXPECT--
<code><span style="color: #000000"> <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> <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>
</span> </span>
</code> </code>

View file

@ -31,4 +31,4 @@ test/file1.php
Warning: include(file2.php): failed to open stream: No such file or directory in %sinclude_path.php on line %d Warning: include(file2.php): failed to open stream: No such file or directory in %sinclude_path.php on line %d
Warning: include(): Failed opening 'file2.php' for inclusion (include_path='%sphar://%stempmanifest1.phar.php/test') in %sinclude_path.php on line %d Warning: include(): Failed opening 'file2.php' for inclusion (include_path='%sphar://%stempmanifest1.phar.php/test') in %sinclude_path.php on line %d
===DONE=== ===DONE===

View file

@ -18,11 +18,11 @@ var_dump(ini_get('phar.readonly'));
__HALT_COMPILER(); __HALT_COMPILER();
?> ?>
--EXPECT-- --EXPECT--
string(1) "1" unicode(1) "1"
string(1) "1" unicode(1) "1"
string(1) "1" unicode(1) "1"
string(1) "1" unicode(1) "1"
string(1) "1" unicode(1) "1"
string(1) "1" unicode(1) "1"
string(1) "1" unicode(1) "1"
string(1) "1" unicode(1) "1"

View file

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

View file

@ -42,4 +42,4 @@ Invalid alias "hi/" specified for phar "%sinvalid_alias.phar"
Invalid alias "hi\l" specified for phar "%sinvalid_alias.phar" Invalid alias "hi\l" specified for phar "%sinvalid_alias.phar"
Invalid alias "hil;" specified for phar "%sinvalid_alias.phar" Invalid alias "hil;" specified for phar "%sinvalid_alias.phar"
Invalid alias ":hil" specified for phar "%sinvalid_alias.phar" Invalid alias ":hil" specified for phar "%sinvalid_alias.phar"
===DONE=== ===DONE===

View file

@ -44,4 +44,4 @@ Cannot set stub ".phar/stub.php" directly in phar "%sinvalid_setstubalias.phar.t
Cannot set alias ".phar/alias.txt" directly in phar "%sinvalid_setstubalias.phar.tar", use setAlias Cannot set alias ".phar/alias.txt" directly in phar "%sinvalid_setstubalias.phar.tar", use setAlias
Cannot set stub ".phar/stub.php" directly in phar "%sinvalid_setstubalias.phar.zip", use setStub Cannot set stub ".phar/stub.php" directly in phar "%sinvalid_setstubalias.phar.zip", use setStub
Cannot set alias ".phar/alias.txt" directly in phar "%sinvalid_setstubalias.phar.zip", use setAlias Cannot set alias ".phar/alias.txt" directly in phar "%sinvalid_setstubalias.phar.zip", use setAlias
===DONE=== ===DONE===

View file

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

View file

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

View file

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

View file

@ -44,4 +44,4 @@ Warning: rmdir(): phar error: cannot remove directory "" in phar "foo.phar", dir
Warning: rmdir(): phar error: cannot remove directory "a" in phar "%smkdir.phar.php", phar error: path "a" exists and is a not a directory in %smkdir.php on line %d Warning: rmdir(): phar error: cannot remove directory "a" in phar "%smkdir.phar.php", phar error: path "a" exists and is a not a directory in %smkdir.php on line %d
Cannot create a directory in magic ".phar" directory Cannot create a directory in magic ".phar" directory
===DONE=== ===DONE===

View file

@ -112,4 +112,4 @@ Mounting of /testit to another\..\mistake within phar %stempmanifest1.phar.php f
Mounting of /notfound to %stests/this/does/not/exist within phar %stempmanifest1.phar.php failed Mounting of /notfound to %stests/this/does/not/exist within phar %stempmanifest1.phar.php failed
Mounting of /testit to %stests within phar %stests/tempmanifest1.phar.php failed Mounting of /testit to %stests within phar %stests/tempmanifest1.phar.php failed
Mounting of /testit/extfile.php to %stests within phar %stests/tempmanifest1.phar.php failed Mounting of /testit/extfile.php to %stests within phar %stests/tempmanifest1.phar.php failed
===DONE=== ===DONE===

View file

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

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php <?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname; $pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>"; $file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array(); $files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>'; $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); set_error_handler("err_handler", E_RECOVERABLE_ERROR);
$fp = fopen($pname . '/b/c.php', 'wb'); $fp = fopen($pname . '/b/c.php', 'wb');
fwrite($fp, 'extra'); fwrite($fp, (binary)'extra');
fclose($fp); fclose($fp);
include $pname . '/b/c.php'; include $pname . '/b/c.php';
?> ?>
@ -32,11 +32,10 @@ include $pname . '/b/c.php';
--CLEAN-- --CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF-- --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: 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 This is b/c
===DONE=== ===DONE===

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php <?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname; $pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>"; $file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array(); $files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>'; $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'; include 'files/phar_test.inc';
$fp = fopen($pname . '/b/c.php', 'wb'); $fp = fopen($pname . '/b/c.php', 'wb');
fwrite($fp, 'extra'); fwrite($fp, (binary)'extra');
fclose($fp); fclose($fp);
include $pname . '/b/c.php'; include $pname . '/b/c.php';
?> ?>
@ -26,11 +26,10 @@ include $pname . '/b/c.php';
--CLEAN-- --CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF-- --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: 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 Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c.php on line %d
This is b/c This is b/c
===DONE=== ===DONE===

View file

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

View file

@ -9,7 +9,7 @@ phar.require_hash=0
<?php <?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname; $pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>"; $file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array(); $files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>'; $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); set_error_handler("err_handler", E_RECOVERABLE_ERROR);
$fp = fopen($pname . '/b/new.php', 'wb'); $fp = fopen($pname . '/b/new.php', 'wb');
fwrite($fp, 'extra'); fwrite($fp, (binary)'extra');
fclose($fp); fclose($fp);
include $pname . '/b/c.php'; include $pname . '/b/c.php';
include $pname . '/b/new.php'; include $pname . '/b/new.php';
@ -34,15 +34,14 @@ include $pname . '/b/new.php';
--CLEAN-- --CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF-- --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: 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 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 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 <?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname; $pname = 'phar://' . $fname;
$file = "<?php __HALT_COMPILER(); ?>"; $file = (binary)"<?php __HALT_COMPILER(); ?>";
$files = array(); $files = array();
$files['a.php'] = '<?php echo "This is a\n"; ?>'; $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'; include 'files/phar_test.inc';
$fp = fopen($pname . '/b/new.php', 'wb'); $fp = fopen($pname . '/b/new.php', 'wb');
fwrite($fp, 'extra'); fwrite($fp, (binary)'extra');
fclose($fp); fclose($fp);
include $pname . '/b/c.php'; include $pname . '/b/c.php';
include $pname . '/b/new.php'; include $pname . '/b/new.php';
@ -28,16 +28,15 @@ include $pname . '/b/new.php';
--CLEAN-- --CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF-- --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: 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 Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c.php on line %d
This is b/c 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(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=== ===DONE===

View file

@ -39,4 +39,4 @@ phar url "phar://" is unknown in %sopendir.php on line %d
Warning: opendir(phar://hi.phar): failed to open dir: phar error: invalid url or non-existent phar "phar://hi.phar" Warning: opendir(phar://hi.phar): failed to open dir: phar error: invalid url or non-existent phar "phar://hi.phar"
phar url "phar://hi.phar" is unknown in %sopendir.php on line %d phar url "phar://hi.phar" is unknown in %sopendir.php on line %d
===DONE=== ===DONE===

View file

@ -37,10 +37,12 @@ include $pname . '/foo';
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php rmdir(dirname(__FILE__) . '/poo'); <?php rmdir(dirname(__FILE__) . '/poo');
--EXPECTF-- --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 foo
Warning: opendir(phar://%sopendir_edgecases.phar.php/oops): failed to open dir: %s in phar://%sopendir_edgecases.phar.php/foo on line %d Warning: opendir(phar://%sopendir_edgecases.phar.php/oops): failed to open dir: %s in phar://%sopendir_edgecases.phar.php/foo on line %d
===DONE=== ===DONE===

View file

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

View file

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

View file

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

View file

@ -23,5 +23,5 @@ unlink(dirname(__FILE__) . '/buildfromiterator.phar');
__HALT_COMPILER(); __HALT_COMPILER();
?> ?>
--EXPECTF-- --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=== ===DONE===

View file

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

View file

@ -50,5 +50,5 @@ unlink(dirname(__FILE__) . '/buildfromiterator.phar');
__HALT_COMPILER(); __HALT_COMPILER();
?> ?>
--EXPECTF-- --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=== ===DONE===

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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