sfox Wed May 14 21:27:31 2008 UTC Modified files: /php-src/ext/phar dirstream.c func_interceptors.c phar.c phar_internal.h phar_object.c shortarc.php stream.c stub.h util.c /php-src/ext/phar/tests 010.phpt 011.phpt 014.phpt phar_commitwrite.phpt phar_convert_repeated.phpt phar_create_in_cwd.phpt phar_createdefaultstub.phpt phar_setdefaultstub.phpt /php-src/ext/phar/tests/tar phar_convert_phar.phpt phar_convert_phar2.phpt /php-src/ext/phar/tests/zip/files corrupt_zipmaker.php.inc /php-src/ext/phar/tests/zip phar_convert_phar.phpt phar_stub.phpt phar_stub_error.phpt refcount1.phpt Log: - Make internal code back-compatible. This included a binary cast in the default stub, hence many test updates. - Just over a third of tests pass. Test manifests are broken currently.
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/dirstream.c?r1=1.27&r2=1.28&diff_format=u Index: php-src/ext/phar/dirstream.c diff -u php-src/ext/phar/dirstream.c:1.27 php-src/ext/phar/dirstream.c:1.28 --- php-src/ext/phar/dirstream.c:1.27 Tue May 13 18:35:25 2008 +++ php-src/ext/phar/dirstream.c Wed May 14 21:27:31 2008 @@ -94,7 +94,8 @@ { size_t to_read; HashTable *data = (HashTable *)stream->abstract; - zstr key; + phar_zstr key; + char *str_key; uint keylen; ulong unused; @@ -104,13 +105,14 @@ 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.s, 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); @@ -186,8 +188,8 @@ { HashTable *data; int dirlen = strlen(dir); - zstr key; - char *entry, *found, *save; + phar_zstr key; + char *entry, *found, *save, *str_key; uint keylen; ulong unused; @@ -204,8 +206,9 @@ 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.s, dir, dirlen)) { + if (keylen < (uint)dirlen || !strncmp(str_key, dir, dirlen)) { if (SUCCESS != zend_hash_move_forward(manifest)) { break; } @@ -214,27 +217,27 @@ } if (*dir == '/') { /* root directory */ - if (NULL != (found = (char *) memchr(key.s, '/', 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.s, 1, 1); - memcpy(entry, key.s, found - key.s); - keylen = found - key.s; + 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.s, keylen); + memcpy(entry, str_key, keylen); entry[keylen] = '\0'; } goto PHAR_ADD_ENTRY; } else { - if (0 != memcmp(key.s, 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.s[dirlen] != '/') { + if (str_key[dirlen] != '/') { if (SUCCESS != zend_hash_move_forward(manifest)) { break; } @@ -242,7 +245,7 @@ } } } - save = key.s; + save = str_key; save += dirlen + 1; /* seek to just past the path separator */ if (NULL != (found = (char *) memchr(save, '/', keylen - dirlen - 1))) { /* is subdirectory */ @@ -290,8 +293,8 @@ { php_url *resource = NULL; php_stream *ret; - char *internal_file, *error; - zstr key; + char *internal_file, *error, *str_key; + phar_zstr key; uint keylen; ulong unused; phar_archive_data *phar; @@ -369,7 +372,8 @@ 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.s, 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); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/func_interceptors.c?r1=1.21&r2=1.22&diff_format=u Index: php-src/ext/phar/func_interceptors.c diff -u php-src/ext/phar/func_interceptors.c:1.21 php-src/ext/phar/func_interceptors.c:1.22 --- php-src/ext/phar/func_interceptors.c:1.21 Tue May 13 18:35:25 2008 +++ php-src/ext/phar/func_interceptors.c Wed May 14 21:27:31 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: func_interceptors.c,v 1.21 2008/05/13 18:35:25 sfox Exp $ */ +/* $Id: func_interceptors.c,v 1.22 2008/05/14 21:27:31 sfox Exp $ */ #include "phar_internal.h" @@ -655,7 +655,8 @@ goto stat_entry; } else { phar_archive_data *phar = *pphar; - zstr key; + phar_zstr key; + char *str_key; uint keylen; ulong unused; @@ -667,11 +668,12 @@ if (HASH_KEY_NON_EXISTANT != zend_hash_get_current_key_ex( &phar->manifest, &key, &keylen, &unused, 0, NULL)) { - if (!memcmp(actual, key.s, 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.s[actual_len] == '/') { + if (str_key[actual_len] == '/') { sb.st_size = 0; sb.st_mode = 0777; sb.st_mode |= S_IFDIR; /* regular directory */ http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.c?r1=1.372&r2=1.373&diff_format=u Index: php-src/ext/phar/phar.c diff -u php-src/ext/phar/phar.c:1.372 php-src/ext/phar/phar.c:1.373 --- php-src/ext/phar/phar.c:1.372 Tue May 13 18:43:18 2008 +++ php-src/ext/phar/phar.c Wed May 14 21:27:31 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: phar.c,v 1.372 2008/05/13 18:43:18 sfox Exp $ */ +/* $Id: phar.c,v 1.373 2008/05/14 21:27:31 sfox Exp $ */ #define PHAR_MAIN 1 #include "phar_internal.h" @@ -817,7 +817,7 @@ 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 */ @@ -1592,7 +1592,8 @@ return FAILURE; } } else { - zstr key; + phar_zstr key; + char *str_key; uint keylen; ulong unused; @@ -1602,11 +1603,13 @@ 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.s, 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; @@ -3023,7 +3026,7 @@ php_info_print_table_header(2, "Phar: PHP Archive support", "enabled"); php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION); php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION); - php_info_print_table_row(2, "CVS revision", "$Revision: 1.372 $"); + php_info_print_table_row(2, "CVS revision", "$Revision: 1.373 $"); php_info_print_table_row(2, "Phar-based phar archives", "enabled"); php_info_print_table_row(2, "Tar-based phar archives", "enabled"); php_info_print_table_row(2, "ZIP-based phar archives", "enabled"); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_internal.h?r1=1.109&r2=1.110&diff_format=u Index: php-src/ext/phar/phar_internal.h diff -u php-src/ext/phar/phar_internal.h:1.109 php-src/ext/phar/phar_internal.h:1.110 --- php-src/ext/phar/phar_internal.h:1.109 Wed May 7 17:24:21 2008 +++ php-src/ext/phar/phar_internal.h Wed May 14 21:27:31 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: phar_internal.h,v 1.109 2008/05/07 17:24:21 cellog Exp $ */ +/* $Id: phar_internal.h,v 1.110 2008/05/14 21:27:31 sfox Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -354,8 +354,17 @@ # 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); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_object.c?r1=1.267&r2=1.268&diff_format=u Index: php-src/ext/phar/phar_object.c diff -u php-src/ext/phar/phar_object.c:1.267 php-src/ext/phar/phar_object.c:1.268 --- php-src/ext/phar/phar_object.c:1.267 Tue May 13 18:35:25 2008 +++ php-src/ext/phar/phar_object.c Wed May 14 21:27:31 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: phar_object.c,v 1.267 2008/05/13 18:35:25 sfox Exp $ */ +/* $Id: phar_object.c,v 1.268 2008/05/14 21:27:31 sfox Exp $ */ #include "phar_internal.h" #include "func_interceptors.h" @@ -778,7 +778,7 @@ mime.len = Z_STRLEN_PP(val); \ } \ mime.type = ret; \ - zend_hash_update(&mimetypes, key.s, 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))) { @@ -786,9 +786,11 @@ } 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; - zstr 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); @@ -797,8 +799,11 @@ #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.s); + 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); @@ -1114,11 +1119,8 @@ 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 { @@ -1316,7 +1318,8 @@ php_stream *fp; long contents_len; char *fname, *error, *base = p_obj->b, *opened, *save = NULL, *temp = NULL; - zstr str_key; + phar_zstr key; + char *str_key; zend_class_entry *ce = p_obj->c; phar_archive_object *phar_obj = p_obj->p; char *str = "[stream]"; @@ -1340,16 +1343,20 @@ 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; } - save = str_key.s; - if (str_key.s[str_key_len - 1] == '\0') str_key_len--; + save = str_key; + if (str_key[str_key_len - 1] == '\0') str_key_len--; } else { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned an invalid key (must return a string)", ce->name); return ZEND_HASH_APPLY_STOP; @@ -1424,9 +1431,9 @@ } return ZEND_HASH_APPLY_KEEP; } - str_key.s = fname + base_len; - if (*str_key.s == '/' || *str_key.s == '\\') { - str_key.s++; + str_key = fname + base_len; + if (*str_key == '/' || *str_key == '\\') { + str_key++; str_key_len--; } } else { @@ -1439,16 +1446,20 @@ } } 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; } - save = str_key.s; - if (str_key.s[str_key_len - 1] == '\0') str_key_len--; + save = str_key; + if (str_key[str_key_len - 1] == '\0') str_key_len--; } else { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned an invalid key (must return a string)", ce->name); return ZEND_HASH_APPLY_STOP; @@ -1492,8 +1503,8 @@ } after_open_fp: - if (!(data = phar_get_or_create_entry_data(phar_obj->arc.archive->fname, phar_obj->arc.archive->fname_len, str_key.s, str_key_len, "w+b", 0, &error TSRMLS_CC))) { - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Entry %s cannot be created: %s", str_key.s, error); + if (!(data = phar_get_or_create_entry_data(phar_obj->arc.archive->fname, phar_obj->arc.archive->fname_len, str_key, str_key_len, "w+b", 0, &error TSRMLS_CC))) { + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Entry %s cannot be created: %s", str_key, error); efree(error); if (save) { efree(save); @@ -1515,7 +1526,7 @@ php_stream_close(fp); } - add_assoc_string(p_obj->ret, str_key.s, opened, 0); + add_assoc_string(p_obj->ret, str_key, opened, 0); if (save) { efree(save); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/shortarc.php?r1=1.12&r2=1.13&diff_format=u Index: php-src/ext/phar/shortarc.php diff -u php-src/ext/phar/shortarc.php:1.12 php-src/ext/phar/shortarc.php:1.13 --- php-src/ext/phar/shortarc.php:1.12 Wed Mar 12 03:55:11 2008 +++ php-src/ext/phar/shortarc.php Wed May 14 21:27:31 2008 @@ -268,7 +268,7 @@ $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)"); } http://cvs.php.net/viewvc.cgi/php-src/ext/phar/stream.c?r1=1.28&r2=1.29&diff_format=u Index: php-src/ext/phar/stream.c diff -u php-src/ext/phar/stream.c:1.28 php-src/ext/phar/stream.c:1.29 --- php-src/ext/phar/stream.c:1.28 Tue May 13 18:35:25 2008 +++ php-src/ext/phar/stream.c Wed May 14 21:27:31 2008 @@ -501,8 +501,8 @@ php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) /* {{{ */ { php_url *resource = NULL; - zstr key; - char *internal_file, *error; + phar_zstr key; + char *internal_file, *error, *str_key; uint keylen; ulong unused; phar_archive_data *phar; @@ -563,9 +563,10 @@ 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.s, 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.s[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; @@ -578,7 +579,8 @@ } /* check for mounted directories */ if (phar->mounted_dirs.arBuckets && zend_hash_num_elements(&phar->mounted_dirs)) { - zstr key; + phar_zstr key; + char *str_key; ulong unused; uint keylen; @@ -587,7 +589,8 @@ 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.s, internal_file, keylen)) { + PHAR_STR(key, str_key); + if ((int)keylen >= internal_file_len || strncmp(str_key, internal_file, keylen)) { continue; } else { char *test; @@ -595,7 +598,7 @@ phar_entry_info *entry; php_stream_statbuf ssbi; - if (SUCCESS != zend_hash_find(&phar->manifest, key.s, keylen, (void **) &entry)) { + if (SUCCESS != zend_hash_find(&phar->manifest, str_key, keylen, (void **) &entry)) { goto free_resource; } if (!entry->tmp || !entry->is_mounted) { http://cvs.php.net/viewvc.cgi/php-src/ext/phar/stub.h?r1=1.13&r2=1.14&diff_format=u Index: php-src/ext/phar/stub.h diff -u php-src/ext/phar/stub.h:1.13 php-src/ext/phar/stub.h:1.14 --- php-src/ext/phar/stub.h:1.13 Wed Mar 12 03:55:11 2008 +++ php-src/ext/phar/stub.h Wed May 14 21:27:31 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: stub.h,v 1.13 2008/03/12 03:55:11 cellog Exp $ */ +/* $Id: stub.h,v 1.14 2008/05/14 21:27:31 sfox Exp $ */ 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) { @@ -25,9 +25,9 @@ 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_sa! ve_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();[EMAIL PROTECTED]($temp, 0777, true);\n$temp = realpath($temp);\n\nif (!file_exists($temp . DIRECTORY_SEPARATOR . md5_file(__FILE__))) {\nself::_removeTmpFiles($temp, getcwd());[EMAIL PROTECTED]($temp, 0777, true);[EMAIL PROTECTED]($temp . '/' . md5_file(__FILE__), '');\n\nforeach ($info['m'] as $path => $file) {\n$a = !file_exists(dirname($temp . '/' . $path));[EMAIL PROTECTED](dirname($temp . '/' . $path), 0777, true);\nclearstatcache();\n\nif ($path[strlen($path) - 1] == '/') [EMAIL PROTECTED]($temp . '/' . $path, 0777);\n} else {\nfile_put_contents($temp . '/' . $path, self::extractFile($path, $file, $fp));[EMAIL PROTECTED]($temp . '! /' . $path, 0666);\n}\n}\n}\n\nchdir($temp);\n\nif (!$return) {\ninclu de 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());[EMAIL PROTECTED]($temp);\nclears! tatcache();\nchdir($origdir);\n}\n}\n\nExtract_Phar::go();\n__HALT_COM PILER(); ?>"; + 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());[EMAIL PROTECTED]($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); } http://cvs.php.net/viewvc.cgi/php-src/ext/phar/util.c?r1=1.56&r2=1.57&diff_format=u Index: php-src/ext/phar/util.c diff -u php-src/ext/phar/util.c:1.56 php-src/ext/phar/util.c:1.57 --- php-src/ext/phar/util.c:1.56 Tue May 13 18:35:25 2008 +++ php-src/ext/phar/util.c Wed May 14 21:27:31 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: util.c,v 1.56 2008/05/13 18:35:25 sfox Exp $ */ +/* $Id: util.c,v 1.57 2008/05/14 21:27:31 sfox Exp $ */ #include "phar_internal.h" #if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300 @@ -1183,7 +1183,8 @@ } return entry; } else if (phar->mounted_dirs.arBuckets && zend_hash_num_elements(&phar->mounted_dirs)) { - zstr key; + phar_zstr key; + char *str_key; ulong unused; uint keylen; @@ -1192,7 +1193,10 @@ 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.s, path, keylen)) { + + PHAR_STR(key, str_key); + + if ((int)keylen >= path_len || strncmp(str_key, path, keylen)) { continue; } else { char *test; @@ -1200,15 +1204,15 @@ phar_entry_info *entry; php_stream_statbuf ssb; - if (SUCCESS != zend_hash_find(&phar->manifest, key.s, 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.s); + 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.s); + spprintf(error, 4096, "phar internal error: mounted path \"%s\" is not properly initialized as a mounted path", str_key); } return NULL; } @@ -1254,7 +1258,8 @@ if (dir) { /* try to find a directory */ HashTable *manifest; - zstr key; + phar_zstr key; + char *str_key; uint keylen; ulong unused; @@ -1267,14 +1272,17 @@ if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(manifest, &key, &keylen, &unused, 0, NULL)) { break; } - if (0 != memcmp(key.s, 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.s[path_len] != '/') { + if (str_key[path_len] != '/') { if (SUCCESS != zend_hash_move_forward(manifest)) { break; } http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/010.phpt?r1=1.12&r2=1.13&diff_format=u Index: php-src/ext/phar/tests/010.phpt diff -u php-src/ext/phar/tests/010.phpt:1.12 php-src/ext/phar/tests/010.phpt:1.13 --- php-src/ext/phar/tests/010.phpt:1.12 Fri Jan 4 16:26:42 2008 +++ php-src/ext/phar/tests/010.phpt Wed May 14 21:27:31 2008 @@ -12,7 +12,7 @@ // 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(''), 0x00000000, 0); +$manifest = pack('V', 1) . 'a' . pack('VVVVVV', 0, time(), 0, crc32((binary)''), 0x00000000, 0); $file .= pack('VVnVV', strlen($manifest), 1, 0x1000, 0x00000000, 3) . 'hio' . pack('V', 0) . $manifest; file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/011.phpt?r1=1.13&r2=1.14&diff_format=u Index: php-src/ext/phar/tests/011.phpt diff -u php-src/ext/phar/tests/011.phpt:1.13 php-src/ext/phar/tests/011.phpt:1.14 --- php-src/ext/phar/tests/011.phpt:1.13 Wed Feb 20 13:11:38 2008 +++ php-src/ext/phar/tests/011.phpt Wed May 14 21:27:31 2008 @@ -12,7 +12,7 @@ Phar::mapPhar('hio'); __HALT_COMPILER(); ?>"; -// compressed file length does not match incompressed lentgh for an uncompressed file +// compressed file length does not match incompressed length for an uncompressed file $files = array(); $files['a'] = array('cont'=>'a','ulen'=>1,'clen'=>2);; http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/014.phpt?r1=1.13&r2=1.14&diff_format=u Index: php-src/ext/phar/tests/014.phpt diff -u php-src/ext/phar/tests/014.phpt:1.13 php-src/ext/phar/tests/014.phpt:1.14 --- php-src/ext/phar/tests/014.phpt:1.13 Wed Feb 20 13:11:38 2008 +++ php-src/ext/phar/tests/014.phpt Wed May 14 21:27:31 2008 @@ -12,7 +12,7 @@ // wrong crc32 $files = array(); -$files['a'] = array('cont'=>'a', 'crc32'=>crc32('aX')); +$files['a'] = array('cont'=>'a', 'crc32'=>crc32((binary)'aX')); include 'files/phar_test.inc'; echo file_get_contents($pname.'/a'); http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_commitwrite.phpt?r1=1.17&r2=1.18&diff_format=u Index: php-src/ext/phar/tests/phar_commitwrite.phpt diff -u php-src/ext/phar/tests/phar_commitwrite.phpt:1.17 php-src/ext/phar/tests/phar_commitwrite.phpt:1.18 --- php-src/ext/phar/tests/phar_commitwrite.phpt:1.17 Wed Mar 12 03:55:11 2008 +++ php-src/ext/phar/tests/phar_commitwrite.phpt Wed May 14 21:27:31 2008 @@ -29,7 +29,7 @@ __HALT_COMPILER(); ?> --EXPECT-- -int(6651) +int(6659) string(200) "<?php function __autoload($class) { http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_convert_repeated.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/phar/tests/phar_convert_repeated.phpt diff -u php-src/ext/phar/tests/phar_convert_repeated.phpt:1.6 php-src/ext/phar/tests/phar_convert_repeated.phpt:1.7 --- php-src/ext/phar/tests/phar_convert_repeated.phpt:1.6 Fri May 2 05:05:54 2008 +++ php-src/ext/phar/tests/phar_convert_repeated.phpt Wed May 14 21:27:31 2008 @@ -123,7 +123,7 @@ bool(true) bool(false) bool(false) -int(6651) +int(6659) NULL ================= convertToZip() ===================== bool(false) http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_create_in_cwd.phpt?r1=1.15&r2=1.16&diff_format=u Index: php-src/ext/phar/tests/phar_create_in_cwd.phpt diff -u php-src/ext/phar/tests/phar_create_in_cwd.phpt:1.15 php-src/ext/phar/tests/phar_create_in_cwd.phpt:1.16 --- php-src/ext/phar/tests/phar_create_in_cwd.phpt:1.15 Wed Mar 12 03:55:11 2008 +++ php-src/ext/phar/tests/phar_create_in_cwd.phpt Wed May 14 21:27:31 2008 @@ -32,7 +32,7 @@ unlink(dirname(__FILE__) . '/brandnewphar.phar'); ?> --EXPECT-- -int(6651) +int(6659) string(200) "<?php function __autoload($class) { http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_createdefaultstub.phpt?r1=1.8&r2=1.9&diff_format=u Index: php-src/ext/phar/tests/phar_createdefaultstub.phpt diff -u php-src/ext/phar/tests/phar_createdefaultstub.phpt:1.8 php-src/ext/phar/tests/phar_createdefaultstub.phpt:1.9 --- php-src/ext/phar/tests/phar_createdefaultstub.phpt:1.8 Wed Mar 12 03:55:11 2008 +++ php-src/ext/phar/tests/phar_createdefaultstub.phpt Wed May 14 21:27:31 2008 @@ -34,7 +34,7 @@ ?> ===DONE=== --EXPECT-- -string(6651) "<?php +string(6659) "<?php $web = 'index.php'; @@ -144,7 +144,7 @@ const BZ2 = 0x2000; const MASK = 0x3000; const START = 'index.php'; -const LEN = 6653; +const LEN = 6661; static function go($return = false) { @@ -298,7 +298,7 @@ $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)"); } @@ -328,7 +328,7 @@ __HALT_COMPILER(); ?>" ============================================================================ ============================================================================ -string(6662) "<?php +string(6670) "<?php $web = 'index.php'; @@ -438,7 +438,7 @@ const BZ2 = 0x2000; const MASK = 0x3000; const START = 'my/custom/thingy.php'; -const LEN = 6664; +const LEN = 6672; static function go($return = false) { @@ -592,7 +592,7 @@ $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)"); } @@ -622,7 +622,7 @@ __HALT_COMPILER(); ?>" ============================================================================ ============================================================================ -int(7042) +int(7050) ============================================================================ ============================================================================ Illegal filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed @@ -630,7 +630,7 @@ ============================================================================ ============================================================================ ============================================================================ -string(6664) "<?php +string(6672) "<?php $web = 'the/web.php'; @@ -740,7 +740,7 @@ const BZ2 = 0x2000; const MASK = 0x3000; const START = 'my/custom/thingy.php'; -const LEN = 6666; +const LEN = 6674; static function go($return = false) { @@ -894,7 +894,7 @@ $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)"); } @@ -924,6 +924,6 @@ __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=== http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/phar_setdefaultstub.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/phar/tests/phar_setdefaultstub.phpt diff -u php-src/ext/phar/tests/phar_setdefaultstub.phpt:1.4 php-src/ext/phar/tests/phar_setdefaultstub.phpt:1.5 --- php-src/ext/phar/tests/phar_setdefaultstub.phpt:1.4 Wed Mar 12 03:55:11 2008 +++ php-src/ext/phar/tests/phar_setdefaultstub.phpt Wed May 14 21:27:31 2008 @@ -54,7 +54,7 @@ unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?> --EXPECT-- -string(6653) "<?php +string(6661) "<?php $web = 'index.php'; @@ -164,7 +164,7 @@ const BZ2 = 0x2000; const MASK = 0x3000; const START = 'index.php'; -const LEN = 6653; +const LEN = 6661; static function go($return = false) { @@ -318,7 +318,7 @@ $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)"); } @@ -349,7 +349,7 @@ " ============================================================================ ============================================================================ -string(6664) "<?php +string(6672) "<?php $web = 'index.php'; @@ -459,7 +459,7 @@ const BZ2 = 0x2000; const MASK = 0x3000; const START = 'my/custom/thingy.php'; -const LEN = 6664; +const LEN = 6672; static function go($return = false) { @@ -613,7 +613,7 @@ $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)"); } @@ -644,7 +644,7 @@ " ============================================================================ ============================================================================ -string(6666) "<?php +string(6674) "<?php $web = 'the/web.php'; @@ -754,7 +754,7 @@ const BZ2 = 0x2000; const MASK = 0x3000; const START = 'my/custom/thingy.php'; -const LEN = 6666; +const LEN = 6674; static function go($return = false) { @@ -908,7 +908,7 @@ $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)"); } @@ -939,6 +939,6 @@ " ============================================================================ ============================================================================ -int(7044) +int(7052) Illegal filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed ===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/tar/phar_convert_phar.phpt?r1=1.9&r2=1.10&diff_format=u Index: php-src/ext/phar/tests/tar/phar_convert_phar.phpt diff -u php-src/ext/phar/tests/tar/phar_convert_phar.phpt:1.9 php-src/ext/phar/tests/tar/phar_convert_phar.phpt:1.10 --- php-src/ext/phar/tests/tar/phar_convert_phar.phpt:1.9 Fri May 2 05:05:54 2008 +++ php-src/ext/phar/tests/tar/phar_convert_phar.phpt Wed May 14 21:27:31 2008 @@ -47,12 +47,12 @@ ?> --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=== http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/tar/phar_convert_phar2.phpt?r1=1.11&r2=1.12&diff_format=u Index: php-src/ext/phar/tests/tar/phar_convert_phar2.phpt diff -u php-src/ext/phar/tests/tar/phar_convert_phar2.phpt:1.11 php-src/ext/phar/tests/tar/phar_convert_phar2.phpt:1.12 --- php-src/ext/phar/tests/tar/phar_convert_phar2.phpt:1.11 Fri May 2 05:05:54 2008 +++ php-src/ext/phar/tests/tar/phar_convert_phar2.phpt Wed May 14 21:27:31 2008 @@ -49,14 +49,14 @@ ?> --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=== http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc?r1=1.5&r2=1.6&diff_format=u Index: php-src/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc diff -u php-src/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc:1.5 php-src/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc:1.6 --- php-src/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc:1.5 Sat Apr 19 06:18:12 2008 +++ php-src/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc Wed May 14 21:27:31 2008 @@ -26,7 +26,7 @@ * @author Vincent Lascaux <[EMAIL PROTECTED]> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: corrupt_zipmaker.php.inc,v 1.5 2008/04/19 06:18:12 cellog Exp $ + * @version CVS: $Id: corrupt_zipmaker.php.inc,v 1.6 2008/05/14 21:27:31 sfox Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -246,7 +246,7 @@ $mtime = $this->getMTime($mtime ? $mtime : null); $uncomplength = strlen($data); - $crc32 = crc32($data) & 0xFFFFFFFF; + $crc32 = crc32((binary)$data) & 0xFFFFFFFF; $compmethod = 0; switch ($compress) { case 'gz' : http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/phar_convert_phar.phpt?r1=1.12&r2=1.13&diff_format=u Index: php-src/ext/phar/tests/zip/phar_convert_phar.phpt diff -u php-src/ext/phar/tests/zip/phar_convert_phar.phpt:1.12 php-src/ext/phar/tests/zip/phar_convert_phar.phpt:1.13 --- php-src/ext/phar/tests/zip/phar_convert_phar.phpt:1.12 Fri May 2 05:05:54 2008 +++ php-src/ext/phar/tests/zip/phar_convert_phar.phpt Wed May 14 21:27:31 2008 @@ -46,12 +46,12 @@ ?> --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=== http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/phar_stub.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/phar/tests/zip/phar_stub.phpt diff -u php-src/ext/phar/tests/zip/phar_stub.phpt:1.1 php-src/ext/phar/tests/zip/phar_stub.phpt:1.2 --- php-src/ext/phar/tests/zip/phar_stub.phpt:1.1 Sat Apr 26 17:47:30 2008 +++ php-src/ext/phar/tests/zip/phar_stub.phpt Wed May 14 21:27:31 2008 @@ -31,7 +31,7 @@ $fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phartmp.php'; $file = '<?php echo "third stub\n"; __HALT_COMPILER(); ?>'; $fp = fopen($fname3, 'wb'); -fwrite($fp, $file); +fwrite($fp, (binary)$file); fclose($fp); $fp = fopen($fname3, 'rb'); @@ -42,7 +42,7 @@ echo $phar->getStub(); $fp = fopen($fname3, 'ab'); -fwrite($fp, 'booya'); +fwrite($fp, (binary)'booya'); fclose($fp); echo file_get_contents($fname3) . "\n"; http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/phar_stub_error.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/phar/tests/zip/phar_stub_error.phpt diff -u php-src/ext/phar/tests/zip/phar_stub_error.phpt:1.4 php-src/ext/phar/tests/zip/phar_stub_error.phpt:1.5 --- php-src/ext/phar/tests/zip/phar_stub_error.phpt:1.4 Tue Feb 12 05:30:58 2008 +++ php-src/ext/phar/tests/zip/phar_stub_error.phpt Wed May 14 21:27:31 2008 @@ -43,7 +43,7 @@ __HALT_COMPILER(); ?> --EXPECTF-- -string(50) "<?php echo "first stub\n"; __HALT_COMPILER(); ?> +unicode(50) "<?php echo "first stub\n"; __HALT_COMPILER(); ?> " string(50) "<?php echo "first stub\n"; __HALT_COMPILER(); ?> " http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/refcount1.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/phar/tests/zip/refcount1.phpt diff -u php-src/ext/phar/tests/zip/refcount1.phpt:1.3 php-src/ext/phar/tests/zip/refcount1.phpt:1.4 --- php-src/ext/phar/tests/zip/refcount1.phpt:1.3 Mon Feb 11 20:55:42 2008 +++ php-src/ext/phar/tests/zip/refcount1.phpt Wed May 14 21:27:31 2008 @@ -29,7 +29,7 @@ $phar->stopBuffering(); $fp = fopen($alias . '/b/c.php', 'wb'); -fwrite($fp, "extra"); +fwrite($fp, (binary)"extra"); fclose($fp); echo "===CLOSE===\n"; $b = fopen($alias . '/b/c.php', 'rb'); @@ -50,9 +50,9 @@ --EXPECTF-- ===CLOSE=== object(PharFileInfo)#%d (2) { - ["pathName":"SplFileInfo":private]=> + [u"pathName":u"SplFileInfo":private]=> string(%d) "phar://%srefcount1.phar.zip/b" - ["fileName":"SplFileInfo":private]=> + [u"fileName":u"SplFileInfo":private]=> string(%d) "phar://%srefcount1.phar.zip/b/c.php" } string(5) "extra" @@ -60,9 +60,9 @@ Warning: unlink(): phar error: "b/c.php" in phar "%srefcount1.phar.zip", has open file pointers, cannot unlink in %srefcount1.php on line %d object(PharFileInfo)#%d (2) { - ["pathName":"SplFileInfo":private]=> + [u"pathName":u"SplFileInfo":private]=> string(%d) "phar://%srefcount1.phar.zip/b" - ["fileName":"SplFileInfo":private]=> + [u"fileName":u"SplFileInfo":private]=> string(%s) "phar://%srefcount1.phar.zip/b/c.php" } string(5) "extra"
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php