37static int phar_file_type(
HashTable *mimes,
char *
file,
char **mime_type)
43 *mime_type =
"text/plain";
49 *mime_type =
"application/octet-stream";
52 *mime_type = mime->
mime;
57static void phar_mung_server_vars(
char *fname,
char *entry,
size_t entry_len,
char *
basename,
size_t request_uri_len)
77 if (code > (
size_t)entry_len && !memcmp(path_info, entry, entry_len)) {
79 ZVAL_STRINGL(stuff, path_info + entry_len, request_uri_len);
101 if (code > basename_len && !memcmp(path_info,
basename, basename_len)) {
103 ZVAL_STRINGL(stuff, path_info + basename_len, code - basename_len);
114 if (code > basename_len && !memcmp(path_info,
basename, basename_len)) {
116 ZVAL_STRINGL(stuff, path_info + basename_len, code - basename_len);
162 if (entry[0] ==
'/') {
221 phar_mung_server_vars(arch, entry, entry_len,
basename, ru_len);
225 if (entry[0] ==
'/') {
226 name_len =
spprintf(&
name, 4096,
"phar://%s%s", arch, entry);
228 name_len =
spprintf(&
name, 4096,
"phar://%s/%s", arch, entry);
238 if ((
cwd = zend_memrchr(entry,
'/', entry_len))) {
244 }
else if (entry[0] ==
'/') {
303static void phar_do_403(
char *entry,
size_t entry_len)
308 ctr.
line_len =
sizeof(
"HTTP/1.0 403 Access Denied")-1;
309 ctr.
line =
"HTTP/1.0 403 Access Denied";
312 PHPWRITE(
"<html>\n <head>\n <title>Access Denied</title>\n </head>\n <body>\n <h1>403 - File ",
sizeof(
"<html>\n <head>\n <title>Access Denied</title>\n </head>\n <body>\n <h1>403 - File ") - 1);
313 PHPWRITE(
"Access Denied</h1>\n </body>\n</html>",
sizeof(
"Access Denied</h1>\n </body>\n</html>") - 1);
317static void phar_do_404(
phar_archive_data *phar,
char *fname,
size_t fname_len,
char *f404,
size_t f404_len,
char *entry,
size_t entry_len)
322 if (phar && f404_len) {
332 ctr.
line_len =
sizeof(
"HTTP/1.0 404 Not Found")-1;
333 ctr.
line =
"HTTP/1.0 404 Not Found";
336 PHPWRITE(
"<html>\n <head>\n <title>File Not Found</title>\n </head>\n <body>\n <h1>404 - File ",
sizeof(
"<html>\n <head>\n <title>File Not Found</title>\n </head>\n <body>\n <h1>404 - File ") - 1);
337 PHPWRITE(
"Not Found</h1>\n </body>\n</html>",
sizeof(
"Not Found</h1>\n </body>\n</html>") - 1);
344static void phar_postprocess_ru_web(
char *fname,
size_t fname_len,
char **entry,
size_t *entry_len,
char **ru,
size_t *ru_len)
347 size_t e_len = *entry_len - 1, u_len = 0;
354 pphar = zend_hash_str_find_ptr(&
cached_phars, fname, fname_len);
358 if (zend_hash_str_exists(&(pphar->
manifest), e, e_len)) {
368 *entry_len = e_len + 1;
405 size_t arch_len, entry_len;
445 char *fname, *arch =
NULL, *entry =
NULL, *path, *actual;
446 size_t fname_len, arch_len, entry_len;
447 size_t path_len, actual_len;
464 fname_len =
ZSTR_LEN(zend_file_name);
469 if (memchr(fname,
'\\', fname_len)) {
470 fname =
do_alloca(fname_len + 1, fname_use_heap);
471 memcpy(fname, save_fname, fname_len);
472 fname[fname_len] =
'\0';
473 phar_unixify_path_separators(fname, fname_len);
477 if (fname_len > 7 && !memcmp(fname,
"phar://", 7) &&
SUCCESS ==
phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
481 if (path_len > 7 && !memcmp(path,
"phar://", 7)) {
482 zend_throw_exception_ex(phar_ce_PharException, 0,
"Can only mount internal paths within a phar archive, use a relative path instead of \"%s\"", path);
504 zend_throw_exception_ex(phar_ce_PharException, 0,
"Mounting of %s to %s within phar %s failed", path, actual, arch);
507 if (entry && path == entry) {
526 path_len = entry_len;
534 if (fname != save_fname) {
554 size_t alias_len = 0, f404_len = 0, free_pathinfo = 0;
556 char *fname, *path_info, *mime_type =
NULL, *entry, *pt;
558 size_t fname_len, index_php_len = 0;
565 if (
zend_parse_parameters(
ZEND_NUM_ARGS(),
"|s!s!s!af!", &alias, &alias_len, &index_php, &index_php_len, &f404, &f404_len, &mimeoverride, &rewrite_fci, &rewrite_fcc) ==
FAILURE) {
580 if (!(
SG(request_info).request_method
581 &&
SG(request_info).request_uri
582 && (!
strcmp(
SG(request_info).request_method,
"GET")
583 || !
strcmp(
SG(request_info).request_method,
"POST")
584 || !
strcmp(
SG(request_info).request_method,
"DELETE")
585 || !
strcmp(
SG(request_info).request_method,
"HEAD")
586 || !
strcmp(
SG(request_info).request_method,
"OPTIONS")
587 || !
strcmp(
SG(request_info).request_method,
"PATCH")
588 || !
strcmp(
SG(request_info).request_method,
"PUT")
601 fname_len =
ZSTR_LEN(zend_file_name);
604 if (memchr(fname,
'\\', fname_len)) {
606 phar_unixify_path_separators(fname, fname_len);
609 basename = zend_memrchr(fname,
'/', fname_len);
617 if ((sapi_mod_name_len ==
sizeof(
"cgi-fcgi") - 1 && !
strncmp(
sapi_module.name,
"cgi-fcgi",
sizeof(
"cgi-fcgi") - 1))
618 || (sapi_mod_name_len ==
sizeof(
"fpm-fcgi") - 1 && !
strncmp(
sapi_module.name,
"fpm-fcgi",
sizeof(
"fpm-fcgi") - 1))
619 || (sapi_mod_name_len ==
sizeof(
"cgi") - 1 && !
strncmp(
sapi_module.name,
"cgi",
sizeof(
"cgi") - 1))
620 || (sapi_mod_name_len ==
sizeof(
"litespeed") - 1 && !
strncmp(
sapi_module.name,
"litespeed",
sizeof(
"litespeed") - 1))) {
624 zval *z_script_name, *z_path_info;
651 testit =
sapi_getenv(
"SCRIPT_NAME",
sizeof(
"SCRIPT_NAME")-1);
657 path_info =
sapi_getenv(
"PATH_INFO",
sizeof(
"PATH_INFO")-1);
661 entry_len =
strlen(entry);
662 spprintf(&path_info, 0,
"%s%s", testit, path_info);
675 path_info =
SG(request_info).request_uri;
682 entry_len =
strlen(path_info);
683 entry_len -= (pt - path_info) + (fname_len - (
basename - fname));
686 pt =
estrndup(path_info, (pt - path_info) + (fname_len - (
basename - fname)));
696 rewrite_fci.
params = ¶ms;
707 zend_throw_exception_ex(phar_ce_PharException, 0,
"phar error: rewrite callback must return a string or false");
719 phar_do_403(entry, entry_len);
728 zend_throw_exception_ex(phar_ce_PharException, 0,
"phar error: rewrite callback must return a string or false");
745 phar_postprocess_ru_web(fname, fname_len, &entry, &entry_len, &ru, &ru_len);
748 if (!entry_len || (entry_len == 1 && entry[0] ==
'/')) {
753 entry_len = index_php_len;
754 if (entry[0] !=
'/') {
755 spprintf(&entry, 0,
"/%s", index_php);
760 entry =
estrndup(
"/index.php",
sizeof(
"/index.php"));
761 entry_len =
sizeof(
"/index.php")-1;
766 phar_do_404(phar, fname, fname_len, f404, f404_len, entry, entry_len);
774 char *tmp =
NULL, sa =
'\0';
777 ctr.
line_len =
sizeof(
"HTTP/1.1 301 Moved Permanently")-1;
778 ctr.
line =
"HTTP/1.1 301 Moved Permanently";
789 if (path_info[
strlen(path_info)-1] ==
'/') {
812 phar_do_404(phar, fname, fname_len, f404, f404_len, entry, entry_len);
816 if (mimeoverride && zend_hash_num_elements(
Z_ARRVAL_P(mimeoverride))) {
817 const char *
ext = zend_memrchr(entry,
'.', entry_len);
830 zend_throw_exception_ex(phar_ce_PharException, 0,
"Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed");
847 zend_throw_exception_ex(phar_ce_PharException, 0,
"Unknown mime type specifier used (not a string or int), only Phar::PHP, Phar::PHPS and a mime type string are allowed");
865 phar_file_action(phar, info, mime_type, code, entry, entry_len, fname, pt, ru, ru_len);
887 if (!zend_hash_num_elements(
Z_ARRVAL_P(mungvalues))) {
888 zend_throw_exception_ex(phar_ce_PharException, 0,
"No values passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
892 if (zend_hash_num_elements(
Z_ARRVAL_P(mungvalues)) > 4) {
893 zend_throw_exception_ex(phar_ce_PharException, 0,
"Too many values passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
902 zend_throw_exception_ex(phar_ce_PharException, 0,
"Non-string value passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
944 size_t index_len = 0, webindex_len = 0;
965 size_t alias_len = 0;
986 size_t fname_len, alias_len = 0;
1059 const char *ext_str;
1063 bool executable = 1;
1096 if (!phar_data->is_persistent) {
1097 ++(phar_data->refcount);
1103 phar_spl_foreign_dtor,
1104 phar_spl_foreign_clone
1118 size_t fname_len, alias_len = 0;
1119 size_t arch_len, entry_len;
1129 is_data = instanceof_function(
Z_OBJCE_P(
zobj), phar_ce_data);
1151 phar_unixify_path_separators(arch, arch_len);
1154 fname_len = arch_len;
1158 arch_len = fname_len;
1160 phar_unixify_path_separators(arch, arch_len);
1166 if (fname == arch && fname != save_fname) {
1181 "Phar creation or opening failed");
1192 if (fname == arch) {
1197 if ((is_data && !phar_data->
is_data) || (!is_data && phar_data->
is_data)) {
1200 "PharData class can only be used for non-executable tar and zip archives");
1203 "Phar class can only be used for executable tar and zip archives");
1215 phar_obj->
archive = phar_data;
1219 fname_len =
spprintf(&fname, 0,
"phar://%s%s", phar_data->
fname, entry);
1222 fname_len =
spprintf(&fname, 0,
"phar://%s", phar_data->
fname);
1258#ifdef PHAR_HAVE_OPENSSL
1263 if (zend_hash_str_exists(&
module_registry,
"openssl",
sizeof(
"openssl")-1)) {
1295 char *fname, *
error, *arch, *entry;
1297 size_t arch_len, entry_len;
1326 if (arch_len == fname_len && !memcmp(arch, fname, arch_len)) {
1327 zend_throw_exception_ex(phar_ce_PharException, 0,
"phar archive \"%s\" cannot be unlinked from within itself", fname);
1337 zend_throw_exception_ex(phar_ce_PharException, 0,
"phar archive \"%s\" is in phar.cache_list, cannot unlinkArchive()", fname);
1342 zend_throw_exception_ex(phar_ce_PharException, 0,
"phar archive \"%s\" has open file handles or objects. fclose() all file handles, and unset() all objects prior to calling unlinkArchive()", fname);
1359#define PHAR_ARCHIVE_OBJECT() \
1360 zval *zobj = ZEND_THIS; \
1361 phar_archive_object *phar_obj = (phar_archive_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset); \
1362 if (!phar_obj->archive) { \
1363 zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
1364 "Cannot call method on an uninitialized Phar object"); \
1402 size_t contents_len;
1452 zval_ptr_dtor_str(&
key);
1471 switch (intern->
type) {
1487 fname_len =
strlen(fname);
1494 goto phar_spl_fileinfo;
1504 fname_len =
strlen(fname);
1506 goto phar_spl_fileinfo;
1533 str_key_len = fname_len - base_len;
1535 if (str_key_len <= 0) {
1543 str_key = fname + base_len;
1545 if (*str_key ==
'/' || *str_key ==
'\\') {
1579 zval_ptr_dtor_str(&
key);
1617 if (str_key_len >=
sizeof(
".phar")-1 && !memcmp(str_key,
".phar",
sizeof(
".phar")-1)) {
1674 data->internal_file->uncompressed_filesize =
data->internal_file->compressed_filesize =
1683 data->internal_file->flags &= ~mask;
1692 add_assoc_str(p_obj->
ret, str_key, opened);
1702 data->internal_file->compressed_filesize =
data->internal_file->uncompressed_filesize = contents_len;
1730 "Cannot write to archive - write operations restricted by INI setting");
1769 if (regex &&
ZSTR_LEN(regex) > 0) {
1856 "Cannot write out phar archive, phar is read-only");
1942 "Cannot convert phar archive \"%s\", unable to open entry \"%s\" contents: %s", entry->
phar->
fname, entry->
filename,
error);
1946 "Cannot convert phar archive \"%s\", unable to open entry \"%s\" contents", entry->
phar->
fname, entry->
filename);
1962 "Cannot convert phar archive \"%s\", unable to copy entry \"%s\" contents", entry->
phar->
fname, entry->
filename);
1968 entry->
cfp = entry->
fp;
1981 const char *oldname =
NULL;
1983 char *oldpath =
NULL;
1985 char *newname =
NULL, *newpath =
NULL;
1989 const char *pcr_error;
1991 size_t new_len, oldname_len, phar_ext_len;
1995 int phar_ext_list_len, i = 0;
1996 char *ext_pos =
NULL;
1999 static const char *
const phar_ext_list[] = {
2023 }
else if (phar->
is_tar) {
2025 switch (phar->
flags) {
2030 ext =
"phar.tar.gz";
2037 ext =
"phar.tar.bz2";
2049 switch (phar->
flags) {
2072 if ((oldname = zend_memrchr(phar->
fname,
'/', phar->
fname_len))) {
2075 oldname = phar->
fname;
2078 oldname_len =
strlen(oldname);
2082 phar_ext_list_len =
sizeof(phar_ext_list)/
sizeof(phar_ext_list[0]);
2085 for (i=0; i < phar_ext_list_len; i++) {
2086 phar_ext_len =
strlen(phar_ext_list[i]);
2087 if (phar_ext_len && oldname_len > phar_ext_len) {
2089 if (memcmp(phar_ext_list[i],
basename + (oldname_len - phar_ext_len), phar_ext_len) == 0) {
2090 ext_pos =
basename + (oldname_len - phar_ext_len);
2107 if (
ext[0] ==
'.') {
2115 new_len =
spprintf(&newpath, 0,
"%s%s", basepath, newname);
2117 phar->
fname = newpath;
2129 if (!zend_hash_num_elements(&phar->
manifest)) {
2134 pphar->
fp = phar->
fp;
2154 goto err_reused_oldpath;
2159 goto err_reused_oldpath;
2166 if (phar->
alias && phar != pphar) {
2182 goto err_reused_oldpath;
2187 if (phar != pphar) {
2213 ce = phar_ce_archive;
2230 if (pphar == phar) {
2271 zend_get_hash_value,
NULL, 0);
2273 zend_get_hash_value,
NULL, 0);
2292 if (newentry.
link) {
2302 if (
FAILURE == phar_copy_file_contents(&newentry, phar->
fp)) {
2325 newentry.
phar = phar;
2327 phar_set_inode(&newentry);
2332 if ((
ret = phar_rename_archive(&phar,
ext))) {
2362 bool format_is_null = 1, method_is_null = 1;
2372 "Cannot write out executable phar archive, phar is read-only");
2376 if (format_is_null) {
2397 "Unknown file format specified, please pass one of Phar::PHAR, Phar::TAR or Phar::ZIP");
2401 if (method_is_null) {
2414 "Cannot compress entire archive with gzip, zip archives do not support whole-archive compression");
2420 "Cannot compress entire archive with gzip, enable ext/zlib in php.ini");
2429 "Cannot compress entire archive with bz2, zip archives do not support whole-archive compression");
2435 "Cannot compress entire archive with bz2, enable ext/bz2 in php.ini");
2443 "Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2");
2473 bool format_is_null = 1, method_is_null = 1;
2481 if (format_is_null) {
2494 "Cannot write out data phar archive, use Phar::TAR or Phar::ZIP");
2500 "Cannot write out data phar archive, use Phar::TAR or Phar::ZIP");
2507 "Unknown file format specified, please pass one of Phar::TAR or Phar::ZIP");
2511 if (method_is_null) {
2524 "Cannot compress entire archive with gzip, zip archives do not support whole-archive compression");
2530 "Cannot compress entire archive with gzip, enable ext/zlib in php.ini");
2539 "Cannot compress entire archive with bz2, zip archives do not support whole-archive compression");
2545 "Cannot compress entire archive with bz2, enable ext/bz2 in php.ini");
2553 "Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2");
2617 RETURN_BOOL((ssb.
sb.st_mode & (S_IWOTH | S_IWGRP | S_IWUSR)) != 0);
2636 "Cannot write out phar archive, phar is read-only");
2703 char *
error, *oldalias;
2705 size_t oldalias_len;
2706 int old_temp, readd = 0;
2716 "Cannot write out phar archive, phar is read-only");
2727 "A Phar alias cannot be set in a plain tar archive");
2730 "A Phar alias cannot be set in a plain zip archive");
2739 spprintf(&
error, 0,
"alias \"%s\" is already used for archive \"%s\" and cannot be used for other archives",
ZSTR_VAL(new_alias), fd_ptr->
fname);
2750 "Invalid alias \"%s\" specified for phar \"%s\"",
ZSTR_VAL(new_alias), phar_obj->
archive->
fname);
2851 "Cannot write out phar archive, phar is read-only");
2880 "Cannot change stub, phar is read-only");
2887 "A Phar stub cannot be set in a plain tar archive");
2890 "A Phar stub cannot be set in a plain zip archive");
2898 zend_string_release(method_name);
2916 if (stub_file_content ==
NULL) {
2931 "Cannot change stub, unable to read from input stream");
2969 size_t index_len = 0, webindex_len = 0;
2970 int created_stub = 0;
2981 "A Phar stub cannot be set in a plain tar archive");
2984 "A Phar stub cannot be set in a plain zip archive");
2996 "Cannot change stub: phar.readonly=1");
3007 zend_string_free(stub);
3022 zend_string_free(stub);
3054 "Cannot set signature algorithm, phar is read-only");
3083 "Unknown signature algorithm specified");
3110 add_assoc_string(
return_value,
"hash_type",
"SHA-256");
3113 add_assoc_string(
return_value,
"hash_type",
"SHA-512");
3116 add_assoc_string(
return_value,
"hash_type",
"OpenSSL");
3119 add_assoc_string(
return_value,
"hash_type",
"OpenSSL_SHA256");
3122 add_assoc_string(
return_value,
"hash_type",
"OpenSSL_SHA512");
3148static int phar_set_compression(
zval *
zv,
void *argument)
3151 uint32_t
compress = *(uint32_t *)argument;
3165static int phar_test_compression(
zval *
zv,
void *argument)
3175 *(
int *) argument = 0;
3181 *(
int *) argument = 0;
3195static int pharobj_cancompress(
HashTable *manifest)
3225 "Cannot compress phar archive, phar is read-only");
3231 "Cannot compress zip-based archives with whole-archive compression");
3242 "Cannot compress entire archive with gzip, enable ext/zlib in php.ini");
3251 "Cannot compress entire archive with bz2, enable ext/bz2 in php.ini");
3258 "Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2");
3291 "Cannot decompress phar archive, phar is read-only");
3297 "Cannot decompress zip-based archives with whole-archive compression");
3333 "Phar is readonly, cannot change compression");
3341 "Cannot compress files within archive with gzip, enable ext/zlib in php.ini");
3350 "Cannot compress files within archive with bz2, enable ext/bz2 in php.ini");
3357 "Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2");
3363 "Cannot compress with Gzip compression, tar archives cannot compress individual files, use compress() to compress the whole archive");
3370 "Cannot compress all files as Gzip, some are compressed as bzip2 and cannot be decompressed");
3373 "Cannot compress all files as Bzip2, some are compressed as gzip and cannot be decompressed");
3407 "Phar is readonly, cannot change compression");
3413 "Cannot decompress all files, some are compressed as bzip2 or gzip and cannot be decompressed");
3443 const char *pcr_error;
3456 "Cannot copy \"%s\" to \"%s\", phar is read-only",
ZSTR_VAL(old_file),
ZSTR_VAL(new_file));
3463 "file \"%s\" cannot be copied to file \"%s\", cannot copy Phar meta-file in %s",
ZSTR_VAL(old_file),
ZSTR_VAL(new_file), phar_obj->
archive->
fname);
3470 "file \"%s\" cannot be copied to file \"%s\", cannot copy to Phar meta-file in %s",
ZSTR_VAL(old_file),
ZSTR_VAL(new_file), phar_obj->
archive->
fname);
3476 "file \"%s\" cannot be copied to file \"%s\", file does not exist in %s",
ZSTR_VAL(old_file),
ZSTR_VAL(new_file), phar_obj->
archive->
fname);
3480 if (
NULL != (temp = zend_hash_find_ptr(&phar_obj->
archive->
manifest, new_file)) && !temp->is_deleted) {
3482 "file \"%s\" cannot be copied to file \"%s\", file must not already exist in phar %s",
ZSTR_VAL(old_file),
ZSTR_VAL(new_file), phar_obj->
archive->
fname);
3486 size_t tmp_len =
ZSTR_LEN(new_file);
3487 char *tmp_new_file =
ZSTR_VAL(new_file);
3490 "file \"%s\" contains invalid characters %s, cannot be copied from \"%s\" in phar %s",
ZSTR_VAL(new_file), pcr_error,
ZSTR_VAL(old_file), phar_obj->
archive->
fname);
3500 oldentry = zend_hash_find_ptr(&phar_obj->
archive->
manifest, old_file);
3613 if (is_initialized ==
FAILURE) {
3628 char *save_filename;
3636 size_t prefix_len = (
ZSTR_VAL(file_name)[0] ==
'/') +
sizeof(
".phar")-1;
3637 char next_char =
ZSTR_VAL(file_name)[prefix_len];
3638 if (next_char ==
'/' || next_char ==
'\\' || next_char ==
'\0') {
3645 char *filename =
ZSTR_VAL(file_name);
3648 save_filename = filename;
3669 if (!
data->internal_file->is_dir) {
3670 size_t contents_len = 0;
3674 if (written_len != contents_len) {
3685 data->internal_file->compressed_filesize =
data->internal_file->uncompressed_filesize = contents_len;
3695 data->internal_file->flags &= ~mask;
3700 if (pphar[0] !=
data->phar) {
3701 *pphar =
data->phar;
3714 if (filename != save_filename) {
3716 filename = save_filename;
3743 if (
data->phar != *pphar) {
3744 *pphar =
data->phar;
3791 phar_add_file(&(phar_obj->
archive), file_name, file_content, zresource);
3858 phar_mkdir(&phar_obj->
archive, dir_name);
3887 file_name = local_name;
3891 phar_add_file(&(phar_obj->
archive), file_name,
NULL, &zresource);
3908 phar_add_file(&(phar_obj->
archive), local_name, file_content,
NULL);
3929 if (
NULL != (stub = zend_hash_str_find_ptr(&(phar_obj->
archive->
manifest),
".phar/stub.php",
sizeof(
".phar/stub.php")-1))) {
3955 "Unable to read stub");
3976 "Unable to read stub");
3982 buf = zend_string_alloc(
len, 0);
3989 "Unable to read stub");
4059 zend_string_release(main_metadata_str.
s);
4065 zend_string_release(main_metadata_str.
s);
4069 tracker->
str = main_metadata_str.
s;
4161 if (entry->
filename_len >=
sizeof(
".phar")-1 && !memcmp(entry->
filename,
".phar",
sizeof(
".phar")-1)) {
4167 new_state.
cwd[1] =
'\0';
4173 spprintf(
error, 4096,
"Cannot extract \"%s...\" to \"%s...\", extracted filename is too long for filesystem", tmp, dest);
4181 filename = new_state.
cwd + 1;
4189 if (
'\\' == filename[cnt]) {
4190 filename[cnt] =
'/';
4196 len =
spprintf(&fullpath, 0,
"%s/%s", dest, filename);
4201 fullpath[50] =
'\0';
4204 spprintf(
error, 4096,
"Cannot extract \"%s...\" to \"%s...\", extracted filename is too long for filesystem", tmp, fullpath);
4207 spprintf(
error, 4096,
"Cannot extract \"%s\" to \"%s...\", extracted filename is too long for filesystem", entry->
filename, fullpath);
4222 spprintf(
error, 4096,
"Cannot extract \"%s\" to \"%s\", openbasedir/safe mode restrictions in effect", entry->
filename, fullpath);
4230 spprintf(
error, 4096,
"Cannot extract \"%s\" to \"%s\", path already exists", entry->
filename, fullpath);
4240 fullpath[dest_len + (slash - filename) + 1] =
'\0';
4242 fullpath[dest_len] =
'\0';
4248 spprintf(
error, 4096,
"Cannot extract \"%s\", could not create directory \"%s\"", entry->
filename, fullpath);
4255 spprintf(
error, 4096,
"Cannot extract \"%s\", could not create directory \"%s\"", entry->
filename, fullpath);
4264 fullpath[dest_len + (slash - filename) + 1] =
'/';
4266 fullpath[dest_len] =
'/';
4280 spprintf(
error, 4096,
"Cannot extract \"%s\", could not open for writing \"%s\"", entry->
filename, fullpath);
4288 spprintf(
error, 4096,
"Cannot extract \"%s\" to \"%s\", unable to open internal file pointer: %s", entry->
filename, fullpath, *
error);
4290 spprintf(
error, 4096,
"Cannot extract \"%s\" to \"%s\", unable to open internal file pointer", entry->
filename, fullpath);
4299 spprintf(
error, 4096,
"Cannot extract \"%s\" to \"%s\", unable to seek internal file pointer", entry->
filename, fullpath);
4306 spprintf(
error, 4096,
"Cannot extract \"%s\" to \"%s\", copying contents failed", entry->
filename, fullpath);
4316 spprintf(
error, 4096,
"Cannot extract \"%s\" to \"%s\", setting file permissions failed", entry->
filename, fullpath);
4333 if (
FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len,
error))
return -1;
4340 if (
FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len,
error))
return -1;
4345 entry = zend_hash_find_ptr(&archive->
manifest, search);
4346 if (
NULL == entry)
return 0;
4347 if (
FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len,
error))
return -1;
4382 "Invalid argument, %s cannot be found", phar_obj->
archive->
fname);
4388 if (pathto_len < 1) {
4390 "Invalid argument, extraction path must be non-zero length");
4406 "Unable to create path \"%s\" for extraction", pathto);
4409 }
else if (!(ssb.
sb.st_mode & S_IFDIR)) {
4411 "Unable to use path \"%s\" for extraction, it is a file, must be a directory", pathto);
4416 if (zend_hash_num_elements(files_ht) == 0) {
4424 "Invalid argument, array of filenames to extract contains non-string value");
4427 switch (extract_helper(phar_obj->
archive,
Z_STR_P(zval_file), pathto, pathto_len, overwrite, &
error)) {
4435 "phar error: attempted to extract non-existent file or directory \"%s\" from phar \"%s\"",
4443 ret = extract_helper(phar_obj->
archive, filename, pathto, pathto_len, overwrite, &
error);
4448 }
else if (0 ==
ret &&
NULL != filename) {
4450 "phar error: attempted to extract non-existent file or directory \"%s\" from phar \"%s\"",
4462 char *fname, *arch, *entry, *
error;
4464 size_t arch_len, entry_len;
4476 if (entry_obj->
entry) {
4481 if (fname_len < 7 || memcmp(fname,
"phar://", 7) ||
phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0) ==
FAILURE) {
4483 "'%s' is not a valid phar archive URL (must have at least phar://filename.phar)", fname);
4492 "Cannot open phar file '%s': %s", fname,
error);
4496 "Cannot open phar file '%s'", fname);
4503 "Cannot access phar file entry '%s' in archive '%s'%s%s", entry, arch,
error ?
", " :
"",
error ?
error :
"");
4512 entry_obj->
entry = entry_info;
4526#define PHAR_ENTRY_OBJECT() \
4527 zval *zobj = ZEND_THIS; \
4528 phar_entry_object *entry_obj = (phar_entry_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset); \
4529 if (!entry_obj->entry) { \
4530 zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
4531 "Cannot call method on an uninitialized PharFileInfo object"); \
4545 if (!entry_obj->
entry) {
4574 RETURN_LONG(entry_obj->entry->compressed_filesize);
4582 bool method_is_null = 1;
4590 if (method_is_null) {
4617 if (entry_obj->entry->is_dir) {
4619 "Phar entry is a directory, does not have a CRC"); \
4623 if (entry_obj->entry->is_crc_checked) {
4670 if (entry_obj->entry->is_temp_dir) {
4672 "Phar entry \"%s\" is a temporary directory (not an actual entry in the archive), cannot chmod", entry_obj->entry->filename); \
4677 zend_throw_exception_ex(phar_ce_PharException, 0,
"Cannot modify permissions for file \"%s\" in phar \"%s\", write operations are prohibited", entry_obj->entry->filename, entry_obj->entry->phar->fname);
4681 if (entry_obj->entry->is_persistent) {
4689 entry_obj->entry = zend_hash_str_find_ptr(&phar->
manifest, entry_obj->entry->filename, entry_obj->entry->filename_len);
4694 entry_obj->entry->flags |= perms;
4695 entry_obj->entry->old_flags = entry_obj->entry->flags;
4696 entry_obj->entry->phar->is_modified = 1;
4697 entry_obj->entry->is_modified = 1;
4701 if (
BG(CurrentLStatFile)) {
4702 zend_string_release(
BG(CurrentLStatFile));
4705 if (
BG(CurrentStatFile)) {
4706 zend_string_release(
BG(CurrentStatFile));
4709 BG(CurrentLStatFile) =
NULL;
4710 BG(CurrentStatFile) =
NULL;
4746 tracker = &entry_obj->entry->metadata_tracker;
4770 if (entry_obj->entry->is_temp_dir) {
4772 "Phar entry is a temporary directory (not an actual entry in the archive), cannot set metadata"); \
4776 if (entry_obj->entry->is_persistent) {
4784 entry_obj->entry = zend_hash_str_find_ptr(&phar->
manifest, entry_obj->entry->filename, entry_obj->entry->filename_len);
4788 if (serialize_metadata_or_throw(&entry_obj->entry->metadata_tracker, entry_obj->entry->is_persistent, metadata) !=
SUCCESS) {
4792 entry_obj->entry->is_modified = 1;
4793 entry_obj->entry->phar->is_modified = 1;
4819 if (entry_obj->entry->is_temp_dir) {
4821 "Phar entry is a temporary directory (not an actual entry in the archive), cannot delete metadata"); \
4826 if (entry_obj->entry->is_persistent) {
4834 entry_obj->entry = zend_hash_str_find_ptr(&phar->
manifest, entry_obj->entry->filename, entry_obj->entry->filename_len);
4838 entry_obj->entry->is_modified = 1;
4839 entry_obj->entry->phar->is_modified = 1;
4871 if (entry_obj->entry->is_dir) {
4873 "phar error: Cannot retrieve contents, \"%s\" in phar \"%s\" is a directory", entry_obj->entry->filename, entry_obj->entry->phar->fname);
4880 link = entry_obj->entry;
4885 "phar error: Cannot retrieve contents, \"%s\" in phar \"%s\": %s", entry_obj->entry->filename, entry_obj->entry->phar->fname,
error);
4892 "phar error: Cannot retrieve contents of \"%s\" in phar \"%s\"", entry_obj->entry->filename, entry_obj->entry->phar->fname);
4918 if (entry_obj->entry->is_tar) {
4920 "Cannot compress with Gzip compression, not possible with tar-based phar archives");
4924 if (entry_obj->entry->is_dir) {
4926 "Phar entry is a directory, cannot set compression"); \
4932 "Phar is readonly, cannot change compression");
4936 if (entry_obj->entry->is_deleted) {
4938 "Cannot compress deleted file");
4942 if (entry_obj->entry->is_persistent) {
4950 entry_obj->entry = zend_hash_str_find_ptr(&phar->
manifest, entry_obj->entry->filename, entry_obj->entry->filename_len);
4961 "Cannot compress with gzip compression, file is already compressed with bzip2 compression and bz2 extension is not enabled, cannot decompress");
4968 "phar error: Cannot decompress bzip2-compressed file \"%s\" in phar \"%s\" in order to compress with gzip: %s", entry_obj->entry->filename, entry_obj->entry->phar->fname,
error);
4976 "Cannot compress with gzip compression, zlib extension is not enabled");
4980 entry_obj->entry->old_flags = entry_obj->entry->flags;
4992 "Cannot compress with bzip2 compression, file is already compressed with gzip compression and zlib extension is not enabled, cannot decompress");
4999 "phar error: Cannot decompress gzip-compressed file \"%s\" in phar \"%s\" in order to compress with bzip2: %s", entry_obj->entry->filename, entry_obj->entry->phar->fname,
error);
5007 "Cannot compress with bzip2 compression, bz2 extension is not enabled");
5010 entry_obj->entry->old_flags = entry_obj->entry->flags;
5019 entry_obj->entry->phar->is_modified = 1;
5020 entry_obj->entry->is_modified = 1;
5037 char *compression_type;
5045 if (entry_obj->entry->is_dir) {
5047 "Phar entry is a directory, cannot set compression"); \
5057 "Phar is readonly, cannot decompress");
5061 if (entry_obj->entry->is_deleted) {
5063 "Cannot compress deleted file");
5069 "Cannot decompress Gzip-compressed file, zlib extension is not enabled");
5075 "Cannot decompress Bzip2-compressed file, bz2 extension is not enabled");
5079 if (entry_obj->entry->is_persistent) {
5087 entry_obj->entry = zend_hash_str_find_ptr(&phar->
manifest, entry_obj->entry->filename, entry_obj->entry->filename_len);
5091 compression_type =
"gzip";
5094 compression_type =
"bz2";
5098 "Cannot decompress file compressed with unknown compression type");
5104 "Phar error: Cannot decompress %s-compressed file \"%s\" in phar \"%s\": %s", compression_type, entry_obj->entry->filename, entry_obj->entry->phar->fname,
error);
5109 entry_obj->entry->old_flags = entry_obj->entry->flags;
5111 entry_obj->entry->phar->is_modified = 1;
5112 entry_obj->entry->is_modified = 1;
SAPI_API sapi_module_struct sapi_module
SAPI_API int sapi_send_headers(void)
SAPI_API char * sapi_getenv(const char *name, size_t name_len)
SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg)
file_private const char ext[]
ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini)
is_executable(string $filename)
unlink(string $filename, $context=null)
file(string $filename, int $flags=0, $context=null)
copy(string $from, string $to, $context=null)
strrchr(string $haystack, string $needle, bool $before_needle=false)
dir(string $directory, $context=null)
chmod(string $filename, int $permissions)
count(Countable|array $value, int $mode=COUNT_NORMAL)
strstr(string $haystack, string $needle, bool $before_needle=false)
basename(string $path, string $suffix="")
link(string $target, string $link)
zend_ffi_ctype_name_buf buf
PHPAPI int php_check_open_basedir(const char *path)
PHPAPI char * expand_filepath(const char *filepath, char *real_path)
void phar_intercept_functions(void)
#define pass(a, b, c, mul)
PHPAPI php_stream_filter * php_stream_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
PHPAPI php_stream_filter * php_stream_filter_remove(php_stream_filter *filter, int call_dtor)
void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_default_stub, char **error)
zend_result phar_detect_phar_fname_ext(const char *filename, size_t filename_len, const char **ext_str, size_t *ext_len, int executable, int for_create, int is_complete)
bool phar_metadata_tracker_has_data(const phar_metadata_tracker *tracker, bool persistent)
void phar_metadata_tracker_free(phar_metadata_tracker *tracker, bool persistent)
void phar_metadata_tracker_clone(phar_metadata_tracker *tracker)
bool phar_archive_delref(phar_archive_data *phar)
zend_result phar_metadata_tracker_unserialize_or_copy(phar_metadata_tracker *tracker, zval *metadata, bool persistent, HashTable *unserialize_options, const char *method_name)
void phar_destroy_phar_data(phar_archive_data *phar)
void phar_flush(phar_archive_data *phar, char **error)
zend_result phar_split_fname(const char *filename, size_t filename_len, char **arch, size_t *arch_len, char **entry, size_t *entry_len, int executable, int for_create)
void phar_metadata_tracker_copy(phar_metadata_tracker *dest, const phar_metadata_tracker *source, bool persistent)
zend_result phar_open_or_create_filename(char *fname, size_t fname_len, char *alias, size_t alias_len, bool is_data, uint32_t options, phar_archive_data **pphar, char **error)
void phar_request_initialize(void)
zend_result phar_open_executed_filename(char *alias, size_t alias_len, char **error)
void destroy_phar_manifest_entry(zval *zv)
zend_string * phar_create_default_stub(const char *index_php, const char *web_index, char **error)
void phar_entry_delref(phar_entry_data *idata)
zend_result phar_open_from_filename(char *fname, size_t fname_len, char *alias, size_t alias_len, uint32_t options, phar_archive_data **pphar, char **error)
#define PHAR_FILE_COMPRESSED_NONE
void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, size_t filename_len)
#define PHAR_SIG_OPENSSL_SHA512
phar_entry_info * phar_get_link_source(phar_entry_info *entry)
#define PHAR_FILE_COMPRESSED_BZ2
struct _phar_metadata_tracker phar_metadata_tracker
phar_path_check_result phar_path_check(char **p, size_t *len, const char **error)
#define PHAR_ENT_COMPRESSED_GZ
int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_off_t position, int follow_links)
#define PHAR_SIG_OPENSSL_SHA256
#define PHAR_FILE_COMPRESSED_GZ
#define PHAR_ENT_PERM_MASK
#define PHP_PHAR_API_VERSION
phar_archive_data * last_phar
zend_result phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **error)
phar_entry_data * phar_get_or_create_entry_data(char *fname, size_t fname_len, char *path, size_t path_len, const char *mode, char allow_dir, char **error, int security)
phar_entry_info * phar_get_entry_info_dir(phar_archive_data *phar, char *path, size_t path_len, char dir, char **error, int security)
int phar_SERVER_mung_list
php_stream * phar_get_efp(phar_entry_info *entry, int follow_links)
#define PHAR_MUNG_PHP_SELF
char * phar_decompress_filter(phar_entry_info *entry, int return_unknown)
HashTable phar_persist_map
#define PHAR_MUNG_SCRIPT_NAME
struct _phar_archive_data phar_archive_data
#define PHAR_ENT_COMPRESSION_MASK
#define PHAR_MUNG_REQUEST_URI
uint32_t openssl_privatekey_len
phar_entry_info * phar_get_entry_info(phar_archive_data *phar, char *path, size_t path_len, char **error, int security)
zend_result phar_mount_entry(phar_archive_data *phar, char *filename, size_t filename_len, char *path, size_t path_len)
#define PHAR_ENT_COMPRESSED_BZ2
zend_result phar_free_alias(phar_archive_data *phar, char *alias, size_t alias_len)
struct _phar_entry_info phar_entry_info
zend_result phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links)
struct _phar_entry_data phar_entry_data
union _phar_archive_object phar_archive_object
struct _phar_mime_type phar_mime_type
#define PHAR_MUNG_SCRIPT_FILENAME
union _phar_entry_object phar_entry_object
#define PHAR_FILE_COMPRESSION_MASK
#define PHAR_ENT_COMPRESSED_NONE
zend_result phar_get_archive(phar_archive_data **archive, char *fname, size_t fname_len, char *alias, size_t alias_len, char **error)
zend_result phar_copy_on_write(phar_archive_data **pphar)
char * openssl_privatekey
phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, char **error)
#define PHAR_ENTRY_OBJECT()
void phar_object_init(void)
#define PHAR_ARCHIVE_OBJECT()
#define TRACK_VARS_SERVER
#define PHPWRITE(str, str_len)
php_output_handler * running
unsigned char key[REFLECTION_KEY_LEN]
#define php_stream_filter_append(chain, filter)
#define php_stream_filter_flush(filter, finish)
#define php_stream_fopen_tmpfile()
#define php_stream_stat_path(path, ssb)
struct _php_stream php_stream
#define php_stream_read(stream, buf, count)
struct _php_stream_filter php_stream_filter
#define php_stream_rewind(stream)
#define php_stream_mkdir(path, mode, options, context)
#define PHP_STREAM_COPY_ALL
#define php_stream_seek(stream, offset, whence)
#define PHP_STREAM_MKDIR_RECURSIVE
#define php_stream_to_zval(stream, zval)
#define php_stream_close(stream)
#define php_stream_tell(stream)
#define php_stream_is_persistent(stream)
#define php_stream_copy_to_mem(src, maxlen, persistent)
#define php_stream_open_wrapper(path, mode, options, opened)
#define php_stream_stat(stream, ssb)
#define php_stream_from_zval_no_verify(xstr, pzval)
#define php_stream_copy_to_stream_ex(src, dest, maxlen, len)
struct _php_stream_statbuf php_stream_statbuf
#define php_stream_write(stream, buf, count)
struct php_serialize_data * php_serialize_data_t
#define PHP_VAR_SERIALIZE_INIT(d)
PHPAPI void php_var_serialize(smart_str *buf, zval *struc, php_serialize_data_t *data)
#define PHP_VAR_SERIALIZE_DESTROY(d)
#define zend_hash_str_add(...)
PHPAPI zend_string * spl_filesystem_object_get_path(const spl_filesystem_object *intern)
PHPAPI zend_class_entry * spl_ce_SplFileInfo
PHPAPI zend_class_entry * spl_ce_RecursiveDirectoryIterator
struct _spl_filesystem_object spl_filesystem_object
#define SPL_FILE_DIR_SKIPDOTS
#define SPL_FILE_DIR_UNIXPATHS
struct _spl_other_handler spl_other_handler
PHPAPI zend_class_entry * spl_ce_BadMethodCallException
PHPAPI zend_class_entry * spl_ce_RuntimeException
PHPAPI zend_class_entry * spl_ce_UnexpectedValueException
PHPAPI zend_class_entry * spl_ce_InvalidArgumentException
PHPAPI zend_result spl_iterator_apply(zval *obj, spl_iterator_apply_func_t apply_func, void *puser)
PHPAPI zend_class_entry * spl_ce_RecursiveIteratorIterator
PHPAPI zend_class_entry * spl_ce_RegexIterator
int(* spl_iterator_apply_func_t)(zend_object_iterator *iter, void *puser)
phar_metadata_tracker metadata_tracker
uint32_t is_temporary_alias
phar_metadata_tracker metadata_tracker
enum phar_fp_type fp_type
uint32_t uncompressed_filesize
php_stream_filter_chain readfilters
const spl_other_handler * oth_handler
union _spl_filesystem_object::@054265167067030002056020365222237177377222266163 u
struct _spl_filesystem_object::@054265167067030002056020365222237177377222266163::@257240036270267375207030141122200245165352304006 dir
zend_class_entry * info_class
zend_function * constructor
void(* get_current_key)(zend_object_iterator *iter, zval *key)
zval *(* get_current_data)(zend_object_iterator *iter)
const zend_object_iterator_funcs * funcs
spl_filesystem_object spl
phar_archive_data * archive
ZEND_API ZEND_COLD void zend_error(int type, const char *format,...)
ZEND_API zend_result add_next_index_stringl(zval *arg, const char *str, size_t length)
ZEND_API HashTable module_registry
ZEND_API zend_result object_init_ex(zval *arg, zend_class_entry *class_type)
ZEND_API zend_result object_init_with_constructor(zval *arg, zend_class_entry *class_type, uint32_t param_count, zval *params, HashTable *named_params)
ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec,...)
ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *format,...)
ZEND_API zend_result zend_parse_parameters_ex(int flags, uint32_t num_args, const char *type_spec,...)
struct _zend_fcall_info_cache zend_fcall_info_cache
#define Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(dest_ht, dest_str)
#define RETURN_STRINGL(s, l)
ZEND_API void zend_call_known_instance_method_with_2_params(zend_function *fn, zend_object *object, zval *retval_ptr, zval *param1, zval *param2)
#define ZEND_PARSE_PARAMS_QUIET
#define ZEND_PARSE_PARAMETERS_END()
#define zend_parse_parameters_none()
#define ZEND_FCI_INITIALIZED(fci)
#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args)
#define RETURN_NEW_STR(s)
struct _zend_fcall_info zend_fcall_info
#define Z_PARAM_ARRAY_HT(dest)
#define Z_PARAM_BOOL(dest)
#define RETURN_EMPTY_STRING()
#define Z_PARAM_PATH(dest, dest_len)
#define ZVAL_STRINGL(z, s, l)
ZEND_API zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache)
#define RETVAL_STRINGL(s, l)
#define estrndup(s, length)
#define ecalloc(nmemb, size)
#define pestrndup(s, length, persistent)
strncmp(string $string1, string $string2, int $length)
strcmp(string $string1, string $string2)
zend_string_release_ex(func->internal_function.function_name, 0)
ZEND_API zend_op_array *(* zend_compile_file)(zend_file_handle *file_handle, int type)
ZEND_API void destroy_op_array(zend_op_array *op_array)
struct _zend_op_array zend_op_array
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle)
ZEND_API zend_class_entry * zend_ce_exception
ZEND_API ZEND_COLD zend_object * zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format,...)
ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value)
ZEND_API zend_string * zend_get_executed_filename_ex(void)
ZEND_API zend_string * get_active_function_or_method_name(void)
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
ZEND_API zval *ZEND_FASTCALL zend_hash_str_find(const HashTable *ht, const char *str, size_t len)
ZEND_API void ZEND_FASTCALL zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument)
ZEND_API zval *ZEND_FASTCALL zend_hash_str_update(HashTable *ht, const char *str, size_t len, zval *pData)
ZEND_API zend_result ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, size_t len)
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
#define ZEND_HASH_APPLY_STOP
#define ZEND_HASH_MAP_FOREACH_PTR(ht, _ptr)
#define HT_IS_INITIALIZED(ht)
#define ZEND_HASH_APPLY_KEEP
#define ZEND_HASH_FOREACH_END()
#define ZEND_HASH_FOREACH_VAL(ht, _val)
ZEND_API zend_result highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini)
zend_syntax_highlighter_ini syntax_highlighter_ini
struct _zend_syntax_highlighter_ini zend_syntax_highlighter_ini
struct _zend_file_handle zend_file_handle
ZEND_API zend_class_entry * zend_ce_countable
ZEND_API zend_class_entry * zend_ce_traversable
ZEND_API zend_class_entry * zend_ce_arrayaccess
struct _zend_object_iterator zend_object_iterator
struct _zend_string zend_string
#define ALLOCA_FLAG(name)
#define do_alloca(p, use_heap)
#define free_alloca(p, use_heap)
#define UNEXPECTED(condition)
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object
ZEND_API void zend_stream_init_filename(zend_file_handle *handle, const char *filename)
#define ZSTR_INIT_LITERAL(s, persistent)
#define zend_string_equals_literal(str, literal)
#define ZSTR_EMPTY_ALLOC()
#define zend_string_starts_with_literal_ci(str, prefix)
#define zend_string_starts_with_literal(str, prefix)
#define Z_STRVAL_P(zval_p)
#define Z_ARRVAL_P(zval_p)
struct _zend_array HashTable
#define Z_STRLEN_P(zval_p)
#define Z_OBJCE_P(zval_p)
#define ZVAL_NEW_STR(z, s)
ZEND_RESULT_CODE zend_result
ZEND_API void zval_ptr_dtor(zval *zval_ptr)
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath)
#define VCWD_CHMOD(path, mode)
struct _cwd_state cwd_state