mirror of
https://github.com/php/php-src.git
synced 2024-12-14 04:16:30 +08:00
Allow createDefaultStub() to accept 0, 1 or 2 parameters. Default for both CLI and web is 'index.php'.
@Greg: this breaks a handful of tests due to the change in stub.h - will fix in a bit. The only one that's interesting is you can't do strlen(Phar::createDefaultStub()) and expect anything other than an exception now.
This commit is contained in:
parent
f78649d8db
commit
7bb00d024e
@ -1701,47 +1701,45 @@ static int phar_flush_clean_deleted_apply(void *data TSRMLS_DC) /* {{{ */
|
||||
char *phar_create_default_stub(const char *index_php, const char *web_index, size_t *len, char **error TSRMLS_DC)
|
||||
{
|
||||
char *stub = NULL;
|
||||
static const char def[] = "index.php";
|
||||
static const char defweb[] = "0";
|
||||
int name_len, web_len;
|
||||
int index_len, web_len;
|
||||
size_t dummy;
|
||||
|
||||
if (!len) {
|
||||
len = &dummy;
|
||||
}
|
||||
|
||||
if (index_php) {
|
||||
name_len = strlen(index_php);
|
||||
}
|
||||
if (web_index) {
|
||||
web_len = strlen(web_index);
|
||||
}
|
||||
if (error) {
|
||||
*error = NULL;
|
||||
}
|
||||
if (index_php && name_len > 400) {
|
||||
/* ridiculous big not allowed for index.php startup filename */
|
||||
|
||||
if (!index_php) {
|
||||
index_php = "index.php";
|
||||
}
|
||||
|
||||
if (!web_index) {
|
||||
web_index = "index.php";
|
||||
}
|
||||
|
||||
index_len = strlen(index_php);
|
||||
web_len = strlen(web_index);
|
||||
|
||||
if (index_len > 400) {
|
||||
/* ridiculous size not allowed for index.php startup filename */
|
||||
if (error) {
|
||||
spprintf(error, 0, "Illegal filename passed in for stub creation, was %d characters long, and only 400 or less is allowed", name_len);
|
||||
spprintf(error, 0, "Illegal filename passed in for stub creation, was %d characters long, and only 400 or less is allowed", index_len);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (web_index && web_len > 400) {
|
||||
/* ridiculous big not allowed for index.php startup filename */
|
||||
|
||||
if (web_len > 400) {
|
||||
/* ridiculous size not allowed for index.php startup filename */
|
||||
if (error) {
|
||||
spprintf(error, 0, "Illegal web filename passed in for stub creation, was %d characters long, and only 400 or less is allowed", web_len);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (!index_php && !web_index) {
|
||||
phar_get_stub(def, defweb, len, &stub, sizeof("index.php")-1, 1 TSRMLS_CC);
|
||||
} else if (!index_php && web_index ){
|
||||
phar_get_stub(def, web_index, len, &stub, sizeof("index.php")-1, web_len+1 TSRMLS_CC);
|
||||
} else if (index_php && !web_index) {
|
||||
phar_get_stub(index_php, defweb, len, &stub, name_len+1, 1 TSRMLS_CC);
|
||||
} else {
|
||||
phar_get_stub(index_php, web_index, len, &stub, name_len+1, web_len+1 TSRMLS_CC);
|
||||
}
|
||||
|
||||
phar_get_stub(index_php, web_index, len, &stub, index_len+1, web_len+1 TSRMLS_CC);
|
||||
return stub;
|
||||
}
|
||||
|
||||
|
@ -898,20 +898,22 @@ PHP_METHOD(Phar, interceptFileFuncs)
|
||||
*/
|
||||
PHP_METHOD(Phar, createDefaultStub)
|
||||
{
|
||||
char *index = NULL, *webindex = NULL, *error;
|
||||
char *index = NULL, *webindex = NULL, *stub, *error;
|
||||
int index_len, webindex_len;
|
||||
size_t stub_len;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ss", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
index = phar_create_default_stub(index, webindex, &stub_len, &error TSRMLS_CC);
|
||||
stub = phar_create_default_stub(index, webindex, &stub_len, &error TSRMLS_CC);
|
||||
|
||||
if (error) {
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, error);
|
||||
efree(error);
|
||||
return;
|
||||
}
|
||||
RETURN_STRINGL(index, stub_len, 0);
|
||||
RETURN_STRINGL(stub, stub_len, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -4,102 +4,98 @@ $web = '000';
|
||||
|
||||
if (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {
|
||||
Phar::interceptFileFuncs();
|
||||
if ($web) {
|
||||
Phar::webPhar(null, $web);
|
||||
}
|
||||
Phar::webPhar(null, $web);
|
||||
include 'phar://' . __FILE__ . '/' . Extract_Phar::START;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($web) {
|
||||
if (@(isset($_SERVER['REQUEST_URI']) && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'POST')) {
|
||||
Extract_Phar::go(true);
|
||||
$mimes = array(
|
||||
'phps' => 2,
|
||||
'c' => 'text/plain',
|
||||
'cc' => 'text/plain',
|
||||
'cpp' => 'text/plain',
|
||||
'c++' => 'text/plain',
|
||||
'dtd' => 'text/plain',
|
||||
'h' => 'text/plain',
|
||||
'log' => 'text/plain',
|
||||
'rng' => 'text/plain',
|
||||
'txt' => 'text/plain',
|
||||
'xsd' => 'text/plain',
|
||||
'php' => 1,
|
||||
'inc' => 1,
|
||||
'avi' => 'video/avi',
|
||||
'bmp' => 'image/bmp',
|
||||
'css' => 'text/css',
|
||||
'gif' => 'image/gif',
|
||||
'htm' => 'text/html',
|
||||
'html' => 'text/html',
|
||||
'htmls' => 'text/html',
|
||||
'ico' => 'image/x-ico',
|
||||
'jpe' => 'image/jpeg',
|
||||
'jpg' => 'image/jpeg',
|
||||
'jpeg' => 'image/jpeg',
|
||||
'js' => 'application/x-javascript',
|
||||
'midi' => 'audio/midi',
|
||||
'mid' => 'audio/midi',
|
||||
'mod' => 'audio/mod',
|
||||
'mov' => 'movie/quicktime',
|
||||
'mp3' => 'audio/mp3',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpeg' => 'video/mpeg',
|
||||
'pdf' => 'application/pdf',
|
||||
'png' => 'image/png',
|
||||
'swf' => 'application/shockwave-flash',
|
||||
'tif' => 'image/tiff',
|
||||
'tiff' => 'image/tiff',
|
||||
'wav' => 'audio/wav',
|
||||
'xbm' => 'image/xbm',
|
||||
'xml' => 'text/xml',
|
||||
);
|
||||
if (@(isset($_SERVER['REQUEST_URI']) && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'POST')) {
|
||||
Extract_Phar::go(true);
|
||||
$mimes = array(
|
||||
'phps' => 2,
|
||||
'c' => 'text/plain',
|
||||
'cc' => 'text/plain',
|
||||
'cpp' => 'text/plain',
|
||||
'c++' => 'text/plain',
|
||||
'dtd' => 'text/plain',
|
||||
'h' => 'text/plain',
|
||||
'log' => 'text/plain',
|
||||
'rng' => 'text/plain',
|
||||
'txt' => 'text/plain',
|
||||
'xsd' => 'text/plain',
|
||||
'php' => 1,
|
||||
'inc' => 1,
|
||||
'avi' => 'video/avi',
|
||||
'bmp' => 'image/bmp',
|
||||
'css' => 'text/css',
|
||||
'gif' => 'image/gif',
|
||||
'htm' => 'text/html',
|
||||
'html' => 'text/html',
|
||||
'htmls' => 'text/html',
|
||||
'ico' => 'image/x-ico',
|
||||
'jpe' => 'image/jpeg',
|
||||
'jpg' => 'image/jpeg',
|
||||
'jpeg' => 'image/jpeg',
|
||||
'js' => 'application/x-javascript',
|
||||
'midi' => 'audio/midi',
|
||||
'mid' => 'audio/midi',
|
||||
'mod' => 'audio/mod',
|
||||
'mov' => 'movie/quicktime',
|
||||
'mp3' => 'audio/mp3',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpeg' => 'video/mpeg',
|
||||
'pdf' => 'application/pdf',
|
||||
'png' => 'image/png',
|
||||
'swf' => 'application/shockwave-flash',
|
||||
'tif' => 'image/tiff',
|
||||
'tiff' => 'image/tiff',
|
||||
'wav' => 'audio/wav',
|
||||
'xbm' => 'image/xbm',
|
||||
'xml' => 'text/xml',
|
||||
);
|
||||
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
$basename = basename(__FILE__);
|
||||
if (!strpos($_SERVER['REQUEST_URI'], $basename)) {
|
||||
chdir(Extract_Phar::$temp);
|
||||
include $web;
|
||||
return;
|
||||
}
|
||||
$pt = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $basename) + strlen($basename));
|
||||
if (!$pt || $pt == '/') {
|
||||
$pt = $web;
|
||||
header('HTTP/1.1 301 Moved Permanently');
|
||||
header('Location: ' . $_SERVER['REQUEST_URI'] . '/' . $pt);
|
||||
$basename = basename(__FILE__);
|
||||
if (!strpos($_SERVER['REQUEST_URI'], $basename)) {
|
||||
chdir(Extract_Phar::$temp);
|
||||
include $web;
|
||||
return;
|
||||
}
|
||||
$pt = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $basename) + strlen($basename));
|
||||
if (!$pt || $pt == '/') {
|
||||
$pt = $web;
|
||||
header('HTTP/1.1 301 Moved Permanently');
|
||||
header('Location: ' . $_SERVER['REQUEST_URI'] . '/' . $pt);
|
||||
exit;
|
||||
}
|
||||
$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
|
||||
if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
echo "<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>";
|
||||
exit;
|
||||
}
|
||||
$b = pathinfo($a);
|
||||
if (!isset($b['extension'])) {
|
||||
header('Content-Type: text/plain');
|
||||
header('Content-Length: ' . filesize($a));
|
||||
readfile($a);
|
||||
exit;
|
||||
}
|
||||
if (isset($mimes[$b['extension']])) {
|
||||
if ($mimes[$b['extension']] === 1) {
|
||||
include $a;
|
||||
exit;
|
||||
}
|
||||
$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);
|
||||
if (!$a || strlen(dirname($a)) < strlen(Extract_Phar::$temp)) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
echo "<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>";
|
||||
exit;
|
||||
}
|
||||
$b = pathinfo($a);
|
||||
if (!isset($b['extension'])) {
|
||||
header('Content-Type: text/plain');
|
||||
header('Content-Length: ' . filesize($a));
|
||||
readfile($a);
|
||||
exit;
|
||||
}
|
||||
if (isset($mimes[$b['extension']])) {
|
||||
if ($mimes[$b['extension']] === 1) {
|
||||
include $a;
|
||||
exit;
|
||||
}
|
||||
if ($mimes[$b['extension']] === 2) {
|
||||
highlight_file($a);
|
||||
exit;
|
||||
}
|
||||
header('Content-Type: ' .$mimes[$b['extension']]);
|
||||
header('Content-Length: ' . filesize($a));
|
||||
readfile($a);
|
||||
if ($mimes[$b['extension']] === 2) {
|
||||
highlight_file($a);
|
||||
exit;
|
||||
}
|
||||
header('Content-Type: ' .$mimes[$b['extension']]);
|
||||
header('Content-Length: ' . filesize($a));
|
||||
readfile($a);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,13 +21,13 @@
|
||||
static inline void phar_get_stub(const char *index_php, const char *web, size_t *len, char **stub, const int name_len, const int web_len TSRMLS_DC)
|
||||
{
|
||||
static const char newstub0[] = "<?php\n\n$web = '";
|
||||
static const char newstub1_0[] = "';\n\nif (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {\nPhar::interceptFileFuncs();\nif ($web) {\nPhar::webPhar(null, $web);\n}\ninclude 'phar://' . __FILE__ . '/' . Extract_Phar::START;\nreturn;\n}\n\nif ($web) {\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(Extract_Phar::$temp)) {\nheader('HTTP/1.0 404 Not Fo";
|
||||
static const char newstub1_1[] = "und');\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}\n\nclass Extract_Phar\n{\nstatic $temp;\nstatic $origdir;\nconst GZ = 0x1000;\nconst BZ2 = 0x2000;\nconst MASK = 0x3000;\nconst START = '";
|
||||
static const char newstub1_0[] = "';\n\nif (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {\nPhar::interceptFileFuncs();\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(Extract_Phar::$temp)) {\nheader('HTTP/1.0 404 Not Found');\necho \"<html>\\n <hea";
|
||||
static const char newstub1_1[] = "d>\\n <title>File Not Found<title>\\n </head>\\n <body>\\n <h1>404 - File \", $pt, \" Not Found</h1>\\n </body>\\n</html>\";\nexit;\n}\n$b = pathinfo($a);\nif (!isset($b['extension'])) {\nheader('Content-Type: text/plain');\nheader('Content-Length: ' . filesize($a));\nreadfile($a);\nexit;\n}\nif (isset($mimes[$b['extension']])) {\nif ($mimes[$b['extension']] === 1) {\ninclude $a;\nexit;\n}\nif ($mimes[$b['extension']] === 2) {\nhighlight_file($a);\nexit;\n}\nheader('Content-Type: ' .$mimes[$b['extension']]);\nheader('Content-Length: ' . filesize($a));\nreadfile($a);\nexit;\n}\n}\n\nclass Extract_Phar\n{\nstatic $temp;\nstatic $origdir;\nconst GZ = 0x1000;\nconst BZ2 = 0x2000;\nconst MASK = 0x3000;\nconst START = '";
|
||||
static const char newstub2[] = "';\nconst LEN = ";
|
||||
static const char newstub3_0[] = ";\n\nstatic function go($return = false)\n{\n$fp = fopen(__FILE__, 'rb');\nfseek($fp, self::LEN);\n$L = unpack('V', $a = fread($fp, 4));\n$m = '';\n\ndo {\n$read = 8192;\nif ($L[1] - strlen($m) < 8192) {\n$read = $L[1] - strlen($m);\n}\n$last = fread($fp, $read);\n$m .= $last;\n} while (strlen($last) && strlen($m) < $L[1]);\n\nif (strlen($m) < $L[1]) {\ndie('ERROR: manifest length read was \"' .\nstrlen($m) .'\" should be \"' .\n$L[1] . '\"');\n}\n\n$info = self::_unpack($m);\n$f = $info['c'];\n\nif ($f & self::GZ) {\nif (!function_exists('gzinflate')) {\ndie('Error: zlib extension is not enabled -' .\n' gzinflate() function needed for zlib-compressed .phars');\n}\n}\n\nif ($f & self::BZ2) {\nif (!function_exists('bzdecompress')) {\ndie('Error: bzip2 extension is not enabled -' .\n' bzdecompress() function needed for bz2-compressed .phars');\n}\n}\n\n$temp = self::tmpdir();\n\nif (!$temp || !is_writable($temp)) {\n$sessionpath = session_save_path();\nif (strpos ($sessionpath, \";\") !== false)\n$sessionpath = substr ($sessionpath, strpos ($sessionpath, \";\")+1);\nif (!file_exists($sessionpath) || !is_dir($sessionpath)) {\ndie('Could not locate temporary directory to extract phar');\n}\n$temp = $sessionpath;\n}\n\n$temp .= '/pharextract/'.basename(__FILE__, '.phar');\nself::$temp = $temp;\nself::$origdir = getcwd();\n@mkdir($temp, 0777, true);\n$temp = realpath($temp);\n\nif (!file_exists($temp . DIRECTORY_SEPARATOR . md5_file(__FILE__))) {\nself::_removeTmpFiles($temp, getcwd());\n@mkdir($temp, 0777, true);\n@file_put_contents($temp . '/' . md5_file(__FILE__), '');\n\nforeach ($info['m'] as $path => $file) {\n$a = !file_exists(dirname($temp . '/' . $path));\n@mkdir(dirname($temp . '/' . $path), 0777, true);\nclearstatcache();\n\nif ($path[strlen($path) - 1] == '/') {\n@mkdir($temp . '/' . $path, 0777);\n} else {\nfile_put_contents($temp . '/' . $path, self::extractFile($path, $file, $fp));\n@chmod($temp . '/' . $path, 0666);\n}\n}\n}\n\nchdir($temp);\n\nif (!$return) {\ninclude self::START;\n}\n}\n\nstatic fun";
|
||||
static const char newstub3_1[] = "ction tmpdir()\n{\nif (strpos(PHP_OS, 'WIN') !== false) {\nif ($var = getenv('TMP') ? getenv('TMP') : getenv('TEMP')) {\nreturn $var;\n}\nif (is_dir('/temp') || mkdir('/temp')) {\nreturn realpath('/temp');\n}\nreturn false;\n}\nif ($var = getenv('TMPDIR')) {\nreturn $var;\n}\nreturn realpath('/tmp');\n}\n\nstatic function _unpack($m)\n{\n$info = unpack('V', substr($m, 0, 4));\n $l = unpack('V', substr($m, 10, 4));\n$m = substr($m, 14 + $l[1]);\n$s = unpack('V', substr($m, 0, 4));\n$o = 0;\n$start = 4 + $s[1];\n$ret['c'] = 0;\n\nfor ($i = 0; $i < $info[1]; $i++) {\n $len = unpack('V', substr($m, $start, 4));\n$start += 4;\n $savepath = substr($m, $start, $len[1]);\n$start += $len[1];\n $ret['m'][$savepath] = array_values(unpack('Va/Vb/Vc/Vd/Ve/Vf', substr($m, $start, 24)));\n$ret['m'][$savepath][3] = sprintf('%u', $ret['m'][$savepath][3]\n& 0xffffffff);\n$ret['m'][$savepath][7] = $o;\n$o += $ret['m'][$savepath][2];\n$start += 24 + $ret['m'][$savepath][5];\n$ret['c'] |= $ret['m'][$savepath][4] & self::MASK;\n}\nreturn $ret;\n}\n\nstatic function extractFile($path, $entry, $fp)\n{\n$data = '';\n$c = $entry[2];\n\nwhile ($c) {\nif ($c < 8192) {\n$data .= @fread($fp, $c);\n$c = 0;\n} else {\n$c -= 8192;\n$data .= @fread($fp, 8192);\n}\n}\n\nif ($entry[4] & self::GZ) {\n$data = gzinflate($data);\n} elseif ($entry[4] & self::BZ2) {\n$data = bzdecompress($data);\n}\n\nif (strlen($data) != $entry[0]) {\ndie(\"Invalid internal .phar file (size error \" . strlen($data) . \" != \" .\n$stat[7] . \")\");\n}\n\nif ($entry[3] != sprintf(\"%u\", crc32($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 int newstub_len = 6581;
|
||||
static const int newstub_len = 6553;
|
||||
|
||||
*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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user