- Make internal code forward-compatible. This included a binary cast in the default stub, hence test updates.
{
size_t to_read;
HashTable *data = (HashTable *)stream->abstract;
- char *key;
+ phar_zstr key;
+ char *str_key;
uint keylen;
ulong unused;
if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(data, &key, &keylen, &unused, 0, NULL)) {
return 0;
}
+ PHAR_STR(key, str_key);
zend_hash_move_forward(data);
to_read = MIN(keylen, count);
if (to_read == 0 || count < keylen) {
return 0;
}
memset(buf, 0, sizeof(php_stream_dirent));
- memcpy(((php_stream_dirent *) buf)->d_name, key, to_read);
+ memcpy(((php_stream_dirent *) buf)->d_name, str_key, to_read);
((php_stream_dirent *) buf)->d_name[to_read + 1] = '\0';
return sizeof(php_stream_dirent);
{
HashTable *data;
int dirlen = strlen(dir);
- char *save, *found, *key;
+ phar_zstr key;
+ char *entry, *found, *save, *str_key;
uint keylen;
ulong unused;
- char *entry;
+
ALLOC_HASHTABLE(data);
zend_hash_init(data, 64, zend_get_hash_value, NULL, 0);
if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(manifest, &key, &keylen, &unused, 0, NULL)) {
break;
}
+ PHAR_STR(key, str_key);
if (keylen <= (uint)dirlen) {
- if (keylen < (uint)dirlen || !strncmp(key, dir, dirlen)) {
+ if (keylen < (uint)dirlen || !strncmp(str_key, dir, dirlen)) {
if (SUCCESS != zend_hash_move_forward(manifest)) {
break;
}
}
if (*dir == '/') {
/* root directory */
- if (NULL != (found = (char *) memchr(key, '/', keylen))) {
+ if (NULL != (found = (char *) memchr(str_key, '/', keylen))) {
/* the entry has a path separator and is a subdirectory */
- entry = (char *) safe_emalloc(found - key, 1, 1);
- memcpy(entry, key, found - key);
- keylen = found - key;
+ entry = (char *) safe_emalloc(found - str_key, 1, 1);
+ memcpy(entry, str_key, found - str_key);
+ keylen = found - str_key;
entry[keylen] = '\0';
} else {
entry = (char *) safe_emalloc(keylen, 1, 1);
- memcpy(entry, key, keylen);
+ memcpy(entry, str_key, keylen);
entry[keylen] = '\0';
}
goto PHAR_ADD_ENTRY;
} else {
- if (0 != memcmp(key, dir, dirlen)) {
+ if (0 != memcmp(str_key, dir, dirlen)) {
/* entry in directory not found */
if (SUCCESS != zend_hash_move_forward(manifest)) {
break;
}
continue;
} else {
- if (key[dirlen] != '/') {
+ if (str_key[dirlen] != '/') {
if (SUCCESS != zend_hash_move_forward(manifest)) {
break;
}
}
}
}
- save = key;
+ save = str_key;
save += dirlen + 1; /* seek to just past the path separator */
if (NULL != (found = (char *) memchr(save, '/', keylen - dirlen - 1))) {
/* is subdirectory */
{
php_url *resource = NULL;
php_stream *ret;
- char *internal_file, *key, *error;
+ char *internal_file, *error, *str_key;
+ phar_zstr key;
uint keylen;
ulong unused;
phar_archive_data *phar;
if (HASH_KEY_NON_EXISTANT !=
zend_hash_get_current_key_ex(
&phar->manifest, &key, &keylen, &unused, 0, NULL)) {
- if (keylen > (uint)i_len && 0 == memcmp(key, internal_file, i_len)) {
+ PHAR_STR(key, str_key);
+ if (keylen > (uint)i_len && 0 == memcmp(str_key, internal_file, i_len)) {
/* directory found */
internal_file = estrndup(internal_file,
i_len);
goto stat_entry;
} else {
phar_archive_data *phar = *pphar;
- char *key;
+ phar_zstr key;
+ char *str_key;
uint keylen;
ulong unused;
if (HASH_KEY_NON_EXISTANT !=
zend_hash_get_current_key_ex(
&phar->manifest, &key, &keylen, &unused, 0, NULL)) {
- if (!memcmp(actual, key, actual_len)) {
+ PHAR_STR(key, str_key);
+ if (!memcmp(actual, str_key, actual_len)) {
efree(save2);
efree(entry);
/* directory found, all dirs have the same stat */
- if (key[actual_len] == '/') {
+ if (str_key[actual_len] == '/') {
sb.st_size = 0;
sb.st_mode = 0777;
sb.st_mode |= S_IFDIR; /* regular directory */
register_alias = 1;
temp_alias = 1;
}
-
+
/* we have 5 32-bit items plus 1 byte at least */
if (manifest_count > ((manifest_len - 10 - tmp_len) / (5 * 4 + 1))) {
/* prevent serious memory issues */
return FAILURE;
}
} else {
- char *key;
+ phar_zstr key;
+ char *str_key;
uint keylen;
ulong unused;
break;
}
+ PHAR_STR(key, str_key);
+
if (keylen > (uint) filename_len) {
zend_hash_move_forward(&(PHAR_GLOBALS->phar_fname_map));
continue;
}
- if (!memcmp(filename, key, keylen) && ((uint)filename_len == keylen
+ if (!memcmp(filename, str_key, keylen) && ((uint)filename_len == keylen
|| filename[keylen] == '/' || filename[keylen] == '\0')) {
if (FAILURE == zend_hash_get_current_data(&(PHAR_GLOBALS->phar_fname_map), (void **) &pphar)) {
break;
}
} else if (phar->flags & PHAR_FILE_COMPRESSION_MASK) {
/* compressed phar */
-#if PHP_VERSION_ID >= 50300 && PHP_VERSION_ID < 60000
+#if PHP_VERSION_ID >= 50300
file_handle->type = ZEND_HANDLE_STREAM;
file_handle->free_filename = 0;
file_handle->handle.stream.handle = phar;
# endif
#endif
-BEGIN_EXTERN_C()
+#if PHP_VERSION_ID >= 60000
+typedef zstr phar_zstr;
+#define PHAR_STR(a, b) \
+ spprintf(&b, 0, "%r", a.s);
+#else
+typedef char *phar_zstr;
+#define PHAR_STR(a, b) \
+ b = a;
+#endif
+BEGIN_EXTERN_C()
#ifdef PHP_WIN32
char *tsrm_strtok_r(char *s, const char *delim, char **last);
mime.len = Z_STRLEN_PP(val); \
} \
mime.type = ret; \
- zend_hash_update(&mimetypes, key, keylen-1, (void *)&mime, sizeof(phar_mime_type), NULL);
+ zend_hash_update(&mimetypes, str_key, keylen-1, (void *)&mime, sizeof(phar_mime_type), NULL);
if (mimeoverride) {
if (!zend_hash_num_elements(Z_ARRVAL_P(mimeoverride))) {
}
for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(mimeoverride)); SUCCESS == zend_hash_has_more_elements(Z_ARRVAL_P(mimeoverride)); zend_hash_move_forward(Z_ARRVAL_P(mimeoverride))) {
zval **val;
- char *key;
+ phar_zstr key;
+ char *str_key;
uint keylen;
ulong intkey;
+
if (HASH_KEY_IS_LONG == zend_hash_get_current_key_ex(Z_ARRVAL_P(mimeoverride), &key, &keylen, &intkey, 0, NULL)) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Key of MIME type overrides array must be a file extension, was \"%d\"", intkey);
phar_entry_delref(phar TSRMLS_CC);
#endif
RETURN_FALSE;
}
+
+ PHAR_STR(key, str_key);
+
if (FAILURE == zend_hash_get_current_data(Z_ARRVAL_P(mimeoverride), (void **) &val)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Failed to retrieve Mime type for extension \"%s\"", key);
+ zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Failed to retrieve Mime type for extension \"%s\"", str_key);
phar_entry_delref(phar TSRMLS_CC);
#ifdef PHP_WIN32
efree(fname);
return;
}
-#if PHP_VERSION_ID >= 60000
- objname = phar_obj->std.ce->name.s;
-#else
- objname = phar_obj->std.ce->name;
-#endif
+ PHAR_STR(phar_obj->std.ce->name, objname);
+
if (!strncmp(objname, "PharData", 8)) {
is_data = 1;
} else {
phar_entry_data *data;
php_stream *fp;
long contents_len;
- char *fname, *error, *str_key, *base = p_obj->b, *opened, *save = NULL, *temp = NULL;
+ char *fname, *error, *base = p_obj->b, *opened, *save = NULL, *temp = NULL;
+ phar_zstr key;
+ char *str_key;
zend_class_entry *ce = p_obj->c;
phar_archive_object *phar_obj = p_obj->p;
char *str = "[stream]";
return ZEND_HASH_APPLY_STOP;
}
if (iter->funcs->get_current_key) {
- key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC);
+ key_type = iter->funcs->get_current_key(iter, &key, &str_key_len, &int_key TSRMLS_CC);
+
if (EG(exception)) {
return ZEND_HASH_APPLY_STOP;
}
+
+ PHAR_STR(key, str_key);
+
if (key_type == HASH_KEY_IS_LONG) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned an invalid key (must return a string)", ce->name);
return ZEND_HASH_APPLY_STOP;
}
} else {
if (iter->funcs->get_current_key) {
- key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC);
+ key_type = iter->funcs->get_current_key(iter, &key, &str_key_len, &int_key TSRMLS_CC);
+
if (EG(exception)) {
return ZEND_HASH_APPLY_STOP;
}
+
+ PHAR_STR(key, str_key);
+
if (key_type == HASH_KEY_IS_LONG) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned an invalid key (must return a string)", ce->name);
return ZEND_HASH_APPLY_STOP;
$stat[7] . ")");
}
- if ($entry[3] != sprintf("%u", crc32($data) & 0xffffffff)) {
+ if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) {
die("Invalid internal .phar file (checksum error)");
}
php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) /* {{{ */
{
php_url *resource = NULL;
- char *internal_file, *key, *error;
+ phar_zstr key;
+ char *internal_file, *error, *str_key;
uint keylen;
ulong unused;
phar_archive_data *phar;
if (HASH_KEY_NON_EXISTANT !=
zend_hash_get_current_key_ex(
&phar->manifest, &key, &keylen, &unused, 0, NULL)) {
- if (keylen >= (uint)internal_file_len && 0 == memcmp(internal_file, key, internal_file_len)) {
+ PHAR_STR(key, str_key);
+ if (keylen >= (uint)internal_file_len && 0 == memcmp(internal_file, str_key, internal_file_len)) {
/* directory found, all dirs have the same stat */
- if (key[internal_file_len] == '/') {
+ if (str_key[internal_file_len] == '/') {
phar_dostat(phar, NULL, ssb, 1, phar->alias, phar->alias_len TSRMLS_CC);
php_url_free(resource);
return SUCCESS;
}
/* check for mounted directories */
if (phar->mounted_dirs.arBuckets && zend_hash_num_elements(&phar->mounted_dirs)) {
- char *key;
+ phar_zstr key;
+ char *str_key;
ulong unused;
uint keylen;
if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &keylen, &unused, 0, NULL)) {
break;
}
- if ((int)keylen >= internal_file_len || strncmp(key, internal_file, keylen)) {
+ PHAR_STR(key, str_key);
+ if ((int)keylen >= internal_file_len || strncmp(str_key, internal_file, keylen)) {
continue;
} else {
char *test;
phar_entry_info *entry;
php_stream_statbuf ssbi;
- if (SUCCESS != zend_hash_find(&phar->manifest, key, keylen, (void **) &entry)) {
+ if (SUCCESS != zend_hash_find(&phar->manifest, str_key, keylen, (void **) &entry)) {
goto free_resource;
}
if (!entry->tmp || !entry->is_mounted) {
static const char newstub1_1[] = "Extract_Phar::$temp)) {\nheader('HTTP/1.0 404 Not Found');\necho \"<html>\\n <head>\\n <title>File Not Found<title>\\n </head>\\n <body>\\n <h1>404 - File \", $pt, \" Not Found</h1>\\n </body>\\n</html>\";\nexit;\n}\n$b = pathinfo($a);\nif (!isset($b['extension'])) {\nheader('Content-Type: text/plain');\nheader('Content-Length: ' . filesize($a));\nreadfile($a);\nexit;\n}\nif (isset($mimes[$b['extension']])) {\nif ($mimes[$b['extension']] === 1) {\ninclude $a;\nexit;\n}\nif ($mimes[$b['extension']] === 2) {\nhighlight_file($a);\nexit;\n}\nheader('Content-Type: ' .$mimes[$b['extension']]);\nheader('Content-Length: ' . filesize($a));\nreadfile($a);\nexit;\n}\n}\n\nclass Extract_Phar\n{\nstatic $temp;\nstatic $origdir;\nconst GZ = 0x1000;\nconst BZ2 = 0x2000;\nconst MASK = 0x3000;\nconst START = '";
static const char newstub2[] = "';\nconst LEN = ";
static const char newstub3_0[] = ";\n\nstatic function go($return = false)\n{\n$fp = fopen(__FILE__, 'rb');\nfseek($fp, self::LEN);\n$L = unpack('V', $a = fread($fp, 4));\n$m = '';\n\ndo {\n$read = 8192;\nif ($L[1] - strlen($m) < 8192) {\n$read = $L[1] - strlen($m);\n}\n$last = fread($fp, $read);\n$m .= $last;\n} while (strlen($last) && strlen($m) < $L[1]);\n\nif (strlen($m) < $L[1]) {\ndie('ERROR: manifest length read was \"' .\nstrlen($m) .'\" should be \"' .\n$L[1] . '\"');\n}\n\n$info = self::_unpack($m);\n$f = $info['c'];\n\nif ($f & self::GZ) {\nif (!function_exists('gzinflate')) {\ndie('Error: zlib extension is not enabled -' .\n' gzinflate() function needed for zlib-compressed .phars');\n}\n}\n\nif ($f & self::BZ2) {\nif (!function_exists('bzdecompress')) {\ndie('Error: bzip2 extension is not enabled -' .\n' bzdecompress() function needed for bz2-compressed .phars');\n}\n}\n\n$temp = self::tmpdir();\n\nif (!$temp || !is_writable($temp)) {\n$sessionpath = session_save_path();\nif (strpos ($sessionpath, \";\") !== false)\n$sessionpath = substr ($sessionpath, strpos ($sessionpath, \";\")+1);\nif (!file_exists($sessionpath) || !is_dir($sessionpath)) {\ndie('Could not locate temporary directory to extract phar');\n}\n$temp = $sessionpath;\n}\n\n$temp .= '/pharextract/'.basename(__FILE__, '.phar');\nself::$temp = $temp;\nself::$origdir = getcwd();\n@mkdir($temp, 0777, true);\n$temp = realpath($temp);\n\nif (!file_exists($temp . DIRECTORY_SEPARATOR . md5_file(__FILE__))) {\nself::_removeTmpFiles($temp, getcwd());\n@mkdir($temp, 0777, true);\n@file_put_contents($temp . '/' . md5_file(__FILE__), '');\n\nforeach ($info['m'] as $path => $file) {\n$a = !file_exists(dirname($temp . '/' . $path));\n@mkdir(dirname($temp . '/' . $path), 0777, true);\nclearstatcache();\n\nif ($path[strlen($path) - 1] == '/') {\n@mkdir($temp . '/' . $path, 0777);\n} else {\nfile_put_contents($temp . '/' . $path, self::extractFile($path, $file, $fp));\n@chmod($temp . '/' . $path, 0666);\n}\n}\n}\n\nchdir($temp);\n\nif (!$return) {\ninclude self::START;\n}\n}\n\nstatic fun";
- static const char newstub3_1[] = "ction tmpdir()\n{\nif (strpos(PHP_OS, 'WIN') !== false) {\nif ($var = getenv('TMP') ? getenv('TMP') : getenv('TEMP')) {\nreturn $var;\n}\nif (is_dir('/temp') || mkdir('/temp')) {\nreturn realpath('/temp');\n}\nreturn false;\n}\nif ($var = getenv('TMPDIR')) {\nreturn $var;\n}\nreturn realpath('/tmp');\n}\n\nstatic function _unpack($m)\n{\n$info = unpack('V', substr($m, 0, 4));\n $l = unpack('V', substr($m, 10, 4));\n$m = substr($m, 14 + $l[1]);\n$s = unpack('V', substr($m, 0, 4));\n$o = 0;\n$start = 4 + $s[1];\n$ret['c'] = 0;\n\nfor ($i = 0; $i < $info[1]; $i++) {\n $len = unpack('V', substr($m, $start, 4));\n$start += 4;\n $savepath = substr($m, $start, $len[1]);\n$start += $len[1];\n $ret['m'][$savepath] = array_values(unpack('Va/Vb/Vc/Vd/Ve/Vf', substr($m, $start, 24)));\n$ret['m'][$savepath][3] = sprintf('%u', $ret['m'][$savepath][3]\n& 0xffffffff);\n$ret['m'][$savepath][7] = $o;\n$o += $ret['m'][$savepath][2];\n$start += 24 + $ret['m'][$savepath][5];\n$ret['c'] |= $ret['m'][$savepath][4] & self::MASK;\n}\nreturn $ret;\n}\n\nstatic function extractFile($path, $entry, $fp)\n{\n$data = '';\n$c = $entry[2];\n\nwhile ($c) {\nif ($c < 8192) {\n$data .= @fread($fp, $c);\n$c = 0;\n} else {\n$c -= 8192;\n$data .= @fread($fp, 8192);\n}\n}\n\nif ($entry[4] & self::GZ) {\n$data = gzinflate($data);\n} elseif ($entry[4] & self::BZ2) {\n$data = bzdecompress($data);\n}\n\nif (strlen($data) != $entry[0]) {\ndie(\"Invalid internal .phar file (size error \" . strlen($data) . \" != \" .\n$stat[7] . \")\");\n}\n\nif ($entry[3] != sprintf(\"%u\", crc32($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[] = "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 int newstub_len = 6633;
+ static const int newstub_len = 6641;
*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);
}
if (empty($comp)) $comp = $cont;
if (empty($ulen)) $ulen = strlen($cont);
if (empty($clen)) $clen = strlen($comp);
- if (empty($crc32))$crc32= crc32($cont);
+ if (empty($crc32))$crc32= crc32((binary)$cont);
if (isset($meta)) $meta = serialize($meta);
// write manifest entry
__HALT_COMPILER();
?>
--EXPECT--
-int(6651)
+int(6659)
string(200) "<?php
function __autoload($class)
{
bool(true)
bool(false)
bool(false)
-int(6651)
+int(6659)
NULL
================= convertToZip() =====================
bool(false)
unlink(dirname(__FILE__) . '/brandnewphar.phar');
?>
--EXPECT--
-int(6651)
+int(6659)
string(200) "<?php
function __autoload($class)
{
?>
===DONE===
--EXPECT--
-string(6651) "<?php
+string(6659) "<?php
$web = 'index.php';
const BZ2 = 0x2000;
const MASK = 0x3000;
const START = 'index.php';
-const LEN = 6653;
+const LEN = 6661;
static function go($return = false)
{
$stat[7] . ")");
}
-if ($entry[3] != sprintf("%u", crc32($data) & 0xffffffff)) {
+if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) {
die("Invalid internal .phar file (checksum error)");
}
__HALT_COMPILER(); ?>"
============================================================================
============================================================================
-string(6662) "<?php
+string(6670) "<?php
$web = 'index.php';
const BZ2 = 0x2000;
const MASK = 0x3000;
const START = 'my/custom/thingy.php';
-const LEN = 6664;
+const LEN = 6672;
static function go($return = false)
{
$stat[7] . ")");
}
-if ($entry[3] != sprintf("%u", crc32($data) & 0xffffffff)) {
+if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) {
die("Invalid internal .phar file (checksum error)");
}
__HALT_COMPILER(); ?>"
============================================================================
============================================================================
-int(7042)
+int(7050)
============================================================================
============================================================================
Illegal filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed
============================================================================
============================================================================
============================================================================
-string(6664) "<?php
+string(6672) "<?php
$web = 'the/web.php';
const BZ2 = 0x2000;
const MASK = 0x3000;
const START = 'my/custom/thingy.php';
-const LEN = 6666;
+const LEN = 6674;
static function go($return = false)
{
$stat[7] . ")");
}
-if ($entry[3] != sprintf("%u", crc32($data) & 0xffffffff)) {
+if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) {
die("Invalid internal .phar file (checksum error)");
}
__HALT_COMPILER(); ?>"
============================================================================
============================================================================
-int(7042)
+int(7050)
Illegal web filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed
===DONE===
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar');
?>
--EXPECT--
-string(6653) "<?php
+string(6661) "<?php
$web = 'index.php';
const BZ2 = 0x2000;
const MASK = 0x3000;
const START = 'index.php';
-const LEN = 6653;
+const LEN = 6661;
static function go($return = false)
{
$stat[7] . ")");
}
-if ($entry[3] != sprintf("%u", crc32($data) & 0xffffffff)) {
+if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) {
die("Invalid internal .phar file (checksum error)");
}
"
============================================================================
============================================================================
-string(6664) "<?php
+string(6672) "<?php
$web = 'index.php';
const BZ2 = 0x2000;
const MASK = 0x3000;
const START = 'my/custom/thingy.php';
-const LEN = 6664;
+const LEN = 6672;
static function go($return = false)
{
$stat[7] . ")");
}
-if ($entry[3] != sprintf("%u", crc32($data) & 0xffffffff)) {
+if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) {
die("Invalid internal .phar file (checksum error)");
}
"
============================================================================
============================================================================
-string(6666) "<?php
+string(6674) "<?php
$web = 'the/web.php';
const BZ2 = 0x2000;
const MASK = 0x3000;
const START = 'my/custom/thingy.php';
-const LEN = 6666;
+const LEN = 6674;
static function go($return = false)
{
$stat[7] . ")");
}
-if ($entry[3] != sprintf("%u", crc32($data) & 0xffffffff)) {
+if ($entry[3] != sprintf("%u", crc32((binary)$data) & 0xffffffff)) {
die("Invalid internal .phar file (checksum error)");
}
"
============================================================================
============================================================================
-int(7044)
+int(7052)
Illegal filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed
===DONE===
?>
--EXPECT--
bool(false)
-int(6651)
+int(6659)
bool(true)
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
bool(true)
-int(6651)
+int(6659)
bool(true)
-int(6651)
+int(6659)
===DONE===
?>
--EXPECT--
bool(false)
-int(6651)
+int(6659)
bool(true)
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
bool(true)
int(4096)
-int(6651)
+int(6659)
bool(true)
bool(true)
-int(6651)
+int(6659)
===DONE===
?>
--EXPECT--
bool(false)
-int(6651)
+int(6659)
bool(true)
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
bool(true)
-int(6651)
+int(6659)
bool(true)
-int(6651)
+int(6659)
===DONE===
}
return entry;
} else if (phar->mounted_dirs.arBuckets && zend_hash_num_elements(&phar->mounted_dirs)) {
- char *key;
+ phar_zstr key;
+ char *str_key;
ulong unused;
uint keylen;
if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &keylen, &unused, 0, NULL)) {
break;
}
- if ((int)keylen >= path_len || strncmp(key, path, keylen)) {
+
+ PHAR_STR(key, str_key);
+
+ if ((int)keylen >= path_len || strncmp(str_key, path, keylen)) {
continue;
} else {
char *test;
phar_entry_info *entry;
php_stream_statbuf ssb;
- if (SUCCESS != zend_hash_find(&phar->manifest, key, keylen, (void **) &entry)) {
+ if (SUCCESS != zend_hash_find(&phar->manifest, str_key, keylen, (void **) &entry)) {
if (error) {
- spprintf(error, 4096, "phar internal error: mounted path \"%s\" could not be retrieved from manifest", key);
+ spprintf(error, 4096, "phar internal error: mounted path \"%s\" could not be retrieved from manifest", str_key);
}
return NULL;
}
if (!entry->tmp || !entry->is_mounted) {
if (error) {
- spprintf(error, 4096, "phar internal error: mounted path \"%s\" is not properly initialized as a mounted path", key);
+ spprintf(error, 4096, "phar internal error: mounted path \"%s\" is not properly initialized as a mounted path", str_key);
}
return NULL;
}
if (dir) {
/* try to find a directory */
HashTable *manifest;
- char *key;
+ phar_zstr key;
+ char *str_key;
uint keylen;
ulong unused;
if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(manifest, &key, &keylen, &unused, 0, NULL)) {
break;
}
- if (0 != memcmp(key, path, path_len)) {
+
+ PHAR_STR(key, str_key);
+
+ if (0 != memcmp(str_key, path, path_len)) {
/* entry in directory not found */
if (SUCCESS != zend_hash_move_forward(manifest)) {
break;
}
continue;
} else {
- if (key[path_len] != '/') {
+ if (str_key[path_len] != '/') {
if (SUCCESS != zend_hash_move_forward(manifest)) {
break;
}