php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
dirstream.c
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | phar:// stream wrapper support |
4 +----------------------------------------------------------------------+
5 | Copyright (c) The PHP Group |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | https://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Authors: Gregory Beaver <cellog@php.net> |
16 | Marcus Boerger <helly@php.net> |
17 +----------------------------------------------------------------------+
18*/
19
20#define PHAR_DIRSTREAM 1
21#include "phar_internal.h"
22#include "dirstream.h"
23
25
26static const php_stream_ops phar_dir_ops = {
27 phar_dir_write, /* write */
28 phar_dir_read, /* read */
29 phar_dir_close, /* close */
30 phar_dir_flush, /* flush */
31 "phar dir",
32 phar_dir_seek, /* seek */
33 NULL, /* cast */
34 NULL, /* stat */
35 NULL, /* set option */
36};
37
41static int phar_dir_close(php_stream *stream, int close_handle) /* {{{ */
42{
43 HashTable *data = (HashTable *)stream->abstract;
44
45 if (data) {
48 stream->abstract = NULL;
49 }
50
51 return 0;
52}
53/* }}} */
54
58static int phar_dir_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset) /* {{{ */
59{
60 HashTable *data = (HashTable *)stream->abstract;
61
62 if (!data) {
63 return -1;
64 }
65
66 if (whence == SEEK_END) {
67 whence = SEEK_SET;
68 offset = zend_hash_num_elements(data) + offset;
69 }
70
71 if (whence == SEEK_SET) {
72 zend_hash_internal_pointer_reset(data);
73 }
74
75 if (offset < 0) {
76 return -1;
77 } else {
78 *newoffset = 0;
79 while (*newoffset < offset && zend_hash_move_forward(data) == SUCCESS) {
80 ++(*newoffset);
81 }
82 return 0;
83 }
84}
85/* }}} */
86
90static ssize_t phar_dir_read(php_stream *stream, char *buf, size_t count) /* {{{ */
91{
92 HashTable *data = (HashTable *)stream->abstract;
93 zend_string *str_key;
94 zend_ulong unused;
95
96 if (count != sizeof(php_stream_dirent)) {
97 return -1;
98 }
99
100 if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key(data, &str_key, &unused)) {
101 return 0;
102 }
103
104 zend_hash_move_forward(data);
105
107
108 if (sizeof(dirent->d_name) <= ZSTR_LEN(str_key)) {
109 return 0;
110 }
111
112 memset(dirent, 0, sizeof(php_stream_dirent));
113 PHP_STRLCPY(dirent->d_name, ZSTR_VAL(str_key), sizeof(dirent->d_name), ZSTR_LEN(str_key));
114
115 return sizeof(php_stream_dirent);
116}
117/* }}} */
118
122static ssize_t phar_dir_write(php_stream *stream, const char *buf, size_t count) /* {{{ */
123{
124 return -1;
125}
126/* }}} */
127
131static int phar_dir_flush(php_stream *stream) /* {{{ */
132{
133 return EOF;
134}
135/* }}} */
136
143static int phar_add_empty(HashTable *ht, char *arKey, uint32_t nKeyLength) /* {{{ */
144{
145 zval dummy;
146
147 ZVAL_NULL(&dummy);
148 zend_hash_str_update(ht, arKey, nKeyLength, &dummy);
149 return SUCCESS;
150}
151/* }}} */
152
156static int phar_compare_dir_name(Bucket *f, Bucket *s) /* {{{ */
157{
159 ZSTR_VAL(f->key), ZSTR_LEN(f->key), ZSTR_VAL(s->key), ZSTR_LEN(s->key));
161}
162/* }}} */
163
169static php_stream *phar_make_dirstream(char *dir, HashTable *manifest) /* {{{ */
170{
172 size_t dirlen = strlen(dir);
173 char *entry, *found, *save;
174 zend_string *str_key;
175 size_t keylen;
176 zend_ulong unused;
177
179 zend_hash_init(data, 64, NULL, NULL, 0);
180
181 if ((*dir == '/' && dirlen == 1 && (manifest->nNumOfElements == 0)) || (dirlen >= sizeof(".phar")-1 && !memcmp(dir, ".phar", sizeof(".phar")-1))) {
182 /* make empty root directory for empty phar */
183 /* make empty directory for .phar magic directory */
184 efree(dir);
185 return php_stream_alloc(&phar_dir_ops, data, NULL, "r");
186 }
187
188 zend_hash_internal_pointer_reset(manifest);
189
190 while (FAILURE != zend_hash_has_more_elements(manifest)) {
191 if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key(manifest, &str_key, &unused)) {
192 break;
193 }
194
195 keylen = ZSTR_LEN(str_key);
196 if (keylen <= dirlen) {
197 if (keylen == 0 || keylen < dirlen || !strncmp(ZSTR_VAL(str_key), dir, dirlen)) {
198 if (SUCCESS != zend_hash_move_forward(manifest)) {
199 break;
200 }
201 continue;
202 }
203 }
204
205 if (*dir == '/') {
206 /* root directory */
207 if (keylen >= sizeof(".phar")-1 && !memcmp(ZSTR_VAL(str_key), ".phar", sizeof(".phar")-1)) {
208 /* do not add any magic entries to this directory */
209 if (SUCCESS != zend_hash_move_forward(manifest)) {
210 break;
211 }
212 continue;
213 }
214
215 if (NULL != (found = (char *) memchr(ZSTR_VAL(str_key), '/', keylen))) {
216 /* the entry has a path separator and is a subdirectory */
217 entry = (char *) safe_emalloc(found - ZSTR_VAL(str_key), 1, 1);
218 memcpy(entry, ZSTR_VAL(str_key), found - ZSTR_VAL(str_key));
219 keylen = found - ZSTR_VAL(str_key);
220 entry[keylen] = '\0';
221 } else {
222 entry = (char *) safe_emalloc(keylen, 1, 1);
223 memcpy(entry, ZSTR_VAL(str_key), keylen);
224 entry[keylen] = '\0';
225 }
226
227 goto PHAR_ADD_ENTRY;
228 } else {
229 if (0 != memcmp(ZSTR_VAL(str_key), dir, dirlen)) {
230 /* entry in directory not found */
231 if (SUCCESS != zend_hash_move_forward(manifest)) {
232 break;
233 }
234 continue;
235 } else {
236 if (ZSTR_VAL(str_key)[dirlen] != '/') {
237 if (SUCCESS != zend_hash_move_forward(manifest)) {
238 break;
239 }
240 continue;
241 }
242 }
243 }
244
245 save = ZSTR_VAL(str_key);
246 save += dirlen + 1; /* seek to just past the path separator */
247
248 if (NULL != (found = (char *) memchr(save, '/', keylen - dirlen - 1))) {
249 /* is subdirectory */
250 save -= dirlen + 1;
251 entry = (char *) safe_emalloc(found - save + dirlen, 1, 1);
252 memcpy(entry, save + dirlen + 1, found - save - dirlen - 1);
253 keylen = found - save - dirlen - 1;
254 entry[keylen] = '\0';
255 } else {
256 /* is file */
257 save -= dirlen + 1;
258 entry = (char *) safe_emalloc(keylen - dirlen, 1, 1);
259 memcpy(entry, save + dirlen + 1, keylen - dirlen - 1);
260 entry[keylen - dirlen - 1] = '\0';
261 keylen = keylen - dirlen - 1;
262 }
263PHAR_ADD_ENTRY:
264 if (keylen) {
265 phar_add_empty(data, entry, keylen);
266 }
267
268 efree(entry);
269
270 if (SUCCESS != zend_hash_move_forward(manifest)) {
271 break;
272 }
273 }
274
275 if (FAILURE != zend_hash_has_more_elements(data)) {
276 efree(dir);
277 zend_hash_sort(data, phar_compare_dir_name, 0);
278 return php_stream_alloc(&phar_dir_ops, data, NULL, "r");
279 } else {
280 efree(dir);
281 return php_stream_alloc(&phar_dir_ops, data, NULL, "r");
282 }
283}
284/* }}}*/
285
289php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC) /* {{{ */
290{
291 php_url *resource = NULL;
293 char *internal_file, *error;
294 zend_string *str_key;
295 zend_ulong unused;
296 phar_archive_data *phar;
297 phar_entry_info *entry = NULL;
298
299 if ((resource = phar_parse_url(wrapper, path, mode, options)) == NULL) {
300 php_stream_wrapper_log_error(wrapper, options, "phar url \"%s\" is unknown", path);
301 return NULL;
302 }
303
304 /* we must have at the very least phar://alias.phar/ */
305 if (!resource->scheme || !resource->host || !resource->path) {
306 if (resource->host && !resource->path) {
307 php_stream_wrapper_log_error(wrapper, options, "phar error: no directory in \"%s\", must have at least phar://%s/ for root directory (always use full path to a new phar)", path, ZSTR_VAL(resource->host));
308 php_url_free(resource);
309 return NULL;
310 }
311 php_url_free(resource);
312 php_stream_wrapper_log_error(wrapper, options, "phar error: invalid url \"%s\", must have at least phar://%s/", path, path);
313 return NULL;
314 }
315
316 if (!zend_string_equals_literal_ci(resource->scheme, "phar")) {
317 php_url_free(resource);
318 php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar url \"%s\"", path);
319 return NULL;
320 }
321
322 size_t host_len = ZSTR_LEN(resource->host);
324 internal_file = ZSTR_VAL(resource->path) + 1; /* strip leading "/" */
325
326 if (FAILURE == phar_get_archive(&phar, ZSTR_VAL(resource->host), host_len, NULL, 0, &error)) {
327 if (error) {
329 efree(error);
330 } else {
331 php_stream_wrapper_log_error(wrapper, options, "phar file \"%s\" is unknown", ZSTR_VAL(resource->host));
332 }
333 php_url_free(resource);
334 return NULL;
335 }
336
337 if (error) {
338 efree(error);
339 }
340
341 if (*internal_file == '\0') {
342 /* root directory requested */
343 internal_file = estrndup(internal_file - 1, 1);
344 ret = phar_make_dirstream(internal_file, &phar->manifest);
345 php_url_free(resource);
346 return ret;
347 }
348
349 if (!HT_IS_INITIALIZED(&phar->manifest)) {
350 php_url_free(resource);
351 return NULL;
352 }
353
354 if (NULL != (entry = zend_hash_str_find_ptr(&phar->manifest, internal_file, strlen(internal_file))) && !entry->is_dir) {
355 php_url_free(resource);
356 return NULL;
357 } else if (entry && entry->is_dir) {
358 if (entry->is_mounted) {
359 php_url_free(resource);
360 return php_stream_opendir(entry->tmp, options, context);
361 }
362 internal_file = estrdup(internal_file);
363 php_url_free(resource);
364 return phar_make_dirstream(internal_file, &phar->manifest);
365 } else {
366 size_t i_len = strlen(internal_file);
367
368 /* search for directory */
369 zend_hash_internal_pointer_reset(&phar->manifest);
370 while (FAILURE != zend_hash_has_more_elements(&phar->manifest)) {
372 zend_hash_get_current_key(&phar->manifest, &str_key, &unused)) {
373 if (ZSTR_LEN(str_key) > i_len && 0 == memcmp(ZSTR_VAL(str_key), internal_file, i_len)) {
374 /* directory found */
375 internal_file = estrndup(internal_file,
376 i_len);
377 php_url_free(resource);
378 return phar_make_dirstream(internal_file, &phar->manifest);
379 }
380 }
381
382 if (SUCCESS != zend_hash_move_forward(&phar->manifest)) {
383 break;
384 }
385 }
386 }
387
388 php_url_free(resource);
389 return NULL;
390}
391/* }}} */
392
396int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mode, int options, php_stream_context *context) /* {{{ */
397{
398 phar_entry_info entry, *e;
399 phar_archive_data *phar = NULL;
400 char *error, *arch, *entry2;
401 size_t arch_len, entry_len;
402 php_url *resource = NULL;
403
404 /* pre-readonly check, we need to know if this is a data phar */
405 if (FAILURE == phar_split_fname(url_from, strlen(url_from), &arch, &arch_len, &entry2, &entry_len, 2, 2)) {
406 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\", no phar archive specified", url_from);
407 return 0;
408 }
409
410 if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL)) {
411 phar = NULL;
412 }
413
414 efree(arch);
415 efree(entry2);
416
417 if (PHAR_G(readonly) && (!phar || !phar->is_data)) {
418 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\", write operations disabled", url_from);
419 return 0;
420 }
421
422 if ((resource = phar_parse_url(wrapper, url_from, "w", options)) == NULL) {
423 return 0;
424 }
425
426 /* we must have at the very least phar://alias.phar/internalfile.php */
427 if (!resource->scheme || !resource->host || !resource->path) {
428 php_url_free(resource);
429 php_stream_wrapper_log_error(wrapper, options, "phar error: invalid url \"%s\"", url_from);
430 return 0;
431 }
432
433 if (!zend_string_equals_literal_ci(resource->scheme, "phar")) {
434 php_url_free(resource);
435 php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar stream url \"%s\"", url_from);
436 return 0;
437 }
438
439 size_t host_len = ZSTR_LEN(resource->host);
440
441 if (FAILURE == phar_get_archive(&phar, ZSTR_VAL(resource->host), host_len, NULL, 0, &error)) {
442 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", error retrieving phar information: %s", ZSTR_VAL(resource->path) + 1, ZSTR_VAL(resource->host), error);
443 efree(error);
444 php_url_free(resource);
445 return 0;
446 }
447
448 if ((e = phar_get_entry_info_dir(phar, ZSTR_VAL(resource->path) + 1, ZSTR_LEN(resource->path) - 1, 2, &error, 1))) {
449 /* directory exists, or is a subdirectory of an existing file */
450 if (e->is_temp_dir) {
451 efree(e->filename);
452 efree(e);
453 }
454 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", directory already exists", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host));
455 php_url_free(resource);
456 return 0;
457 }
458
459 if (error) {
460 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host), error);
461 efree(error);
462 php_url_free(resource);
463 return 0;
464 }
465
466 if (phar_get_entry_info_dir(phar, ZSTR_VAL(resource->path) + 1, ZSTR_LEN(resource->path) - 1, 0, &error, 1)) {
467 /* entry exists as a file */
468 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", file already exists", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host));
469 php_url_free(resource);
470 return 0;
471 }
472
473 if (error) {
474 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host), error);
475 efree(error);
476 php_url_free(resource);
477 return 0;
478 }
479
480 memset((void *) &entry, 0, sizeof(phar_entry_info));
481
482 /* strip leading "/" */
483 if (phar->is_zip) {
484 entry.is_zip = 1;
485 }
486
487 entry.filename = estrdup(ZSTR_VAL(resource->path) + 1);
488
489 if (phar->is_tar) {
490 entry.is_tar = 1;
491 entry.tar_type = TAR_DIR;
492 }
493
494 entry.filename_len = ZSTR_LEN(resource->path) - 1;
495 php_url_free(resource);
496 entry.is_dir = 1;
497 entry.phar = phar;
498 entry.is_modified = 1;
499 entry.is_crc_checked = 1;
502
503 if (NULL == zend_hash_str_add_mem(&phar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info))) {
504 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", adding to manifest failed", entry.filename, phar->fname);
505 efree(error);
506 efree(entry.filename);
507 return 0;
508 }
509
510 phar_flush(phar, &error);
511
512 if (error) {
513 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", entry.filename, phar->fname, error);
514 zend_hash_str_del(&phar->manifest, entry.filename, entry.filename_len);
515 efree(error);
516 return 0;
517 }
518
519 phar_add_virtual_dirs(phar, entry.filename, entry.filename_len);
520 return 1;
521}
522/* }}} */
523
527int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context) /* {{{ */
528{
529 phar_entry_info *entry;
530 phar_archive_data *phar = NULL;
531 char *error, *arch, *entry2;
532 size_t arch_len, entry_len;
533 php_url *resource = NULL;
534 zend_string *str_key;
535 zend_ulong unused;
536
537 /* pre-readonly check, we need to know if this is a data phar */
538 if (FAILURE == phar_split_fname(url, strlen(url), &arch, &arch_len, &entry2, &entry_len, 2, 2)) {
539 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\", no phar archive specified, or phar archive does not exist", url);
540 return 0;
541 }
542
543 if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL)) {
544 phar = NULL;
545 }
546
547 efree(arch);
548 efree(entry2);
549
550 if (PHAR_G(readonly) && (!phar || !phar->is_data)) {
551 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot rmdir directory \"%s\", write operations disabled", url);
552 return 0;
553 }
554
555 if ((resource = phar_parse_url(wrapper, url, "w", options)) == NULL) {
556 return 0;
557 }
558
559 /* we must have at the very least phar://alias.phar/internalfile.php */
560 if (!resource->scheme || !resource->host || !resource->path) {
561 php_url_free(resource);
562 php_stream_wrapper_log_error(wrapper, options, "phar error: invalid url \"%s\"", url);
563 return 0;
564 }
565
566 if (!zend_string_equals_literal_ci(resource->scheme, "phar")) {
567 php_url_free(resource);
568 php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar stream url \"%s\"", url);
569 return 0;
570 }
571
572 size_t host_len = ZSTR_LEN(resource->host);
573
574 if (FAILURE == phar_get_archive(&phar, ZSTR_VAL(resource->host), host_len, NULL, 0, &error)) {
575 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", error retrieving phar information: %s", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host), error);
576 efree(error);
577 php_url_free(resource);
578 return 0;
579 }
580
581 size_t path_len = ZSTR_LEN(resource->path) - 1;
582
583 if (!(entry = phar_get_entry_info_dir(phar, ZSTR_VAL(resource->path) + 1, path_len, 2, &error, 1))) {
584 if (error) {
585 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", %s", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host), error);
586 efree(error);
587 } else {
588 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", directory does not exist", ZSTR_VAL(resource->path)+1, ZSTR_VAL(resource->host));
589 }
590 php_url_free(resource);
591 return 0;
592 }
593
594 if (!entry->is_deleted) {
595 for (zend_hash_internal_pointer_reset(&phar->manifest);
596 HASH_KEY_NON_EXISTENT != zend_hash_get_current_key(&phar->manifest, &str_key, &unused);
597 zend_hash_move_forward(&phar->manifest)
598 ) {
599 if (ZSTR_LEN(str_key) > path_len &&
600 memcmp(ZSTR_VAL(str_key), ZSTR_VAL(resource->path)+1, path_len) == 0 &&
601 IS_SLASH(ZSTR_VAL(str_key)[path_len])) {
602 php_stream_wrapper_log_error(wrapper, options, "phar error: Directory not empty");
603 if (entry->is_temp_dir) {
604 efree(entry->filename);
605 efree(entry);
606 }
607 php_url_free(resource);
608 return 0;
609 }
610 }
611
612 for (zend_hash_internal_pointer_reset(&phar->virtual_dirs);
613 HASH_KEY_NON_EXISTENT != zend_hash_get_current_key(&phar->virtual_dirs, &str_key, &unused);
614 zend_hash_move_forward(&phar->virtual_dirs)) {
615
616 if (ZSTR_LEN(str_key) > path_len &&
617 memcmp(ZSTR_VAL(str_key), ZSTR_VAL(resource->path)+1, path_len) == 0 &&
618 IS_SLASH(ZSTR_VAL(str_key)[path_len])) {
619 php_stream_wrapper_log_error(wrapper, options, "phar error: Directory not empty");
620 if (entry->is_temp_dir) {
621 efree(entry->filename);
622 efree(entry);
623 }
624 php_url_free(resource);
625 return 0;
626 }
627 }
628 }
629
630 if (entry->is_temp_dir) {
631 zend_hash_str_del(&phar->virtual_dirs, ZSTR_VAL(resource->path)+1, path_len);
632 efree(entry->filename);
633 efree(entry);
634 } else {
635 entry->is_deleted = 1;
636 entry->is_modified = 1;
637 phar_flush(phar, &error);
638
639 if (error) {
640 php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", %s", entry->filename, phar->fname, error);
641 php_url_free(resource);
642 efree(error);
643 return 0;
644 }
645 }
646
647 php_url_free(resource);
648 return 1;
649}
650/* }}} */
is_dir(string $filename)
dir(string $directory, $context=null)
count(Countable|array $value, int $mode=COUNT_NORMAL)
char s[4]
Definition cdf.c:77
int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context)
Definition dirstream.c:527
int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mode, int options, php_stream_context *context)
Definition dirstream.c:396
php_stream * phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC)
Definition dirstream.c:289
void phar_dostat(phar_archive_data *phar, phar_entry_info *data, php_stream_statbuf *ssb, bool is_dir)
Definition stream.c:492
error($message)
Definition ext_skel.php:22
memcpy(ptr1, ptr2, size)
memset(ptr, 0, type->size)
HashTable * ht
Definition ffi.c:4838
zend_ffi_ctype_name_buf buf
Definition ffi.c:4685
const SEEK_END
Definition file.stub.php:21
zend_long offset
char * mode
#define SEEK_SET
Definition gd_io_file.c:20
#define NULL
Definition gdcache.h:45
#define SUCCESS
Definition hash_sha3.c:261
phar_globals readonly
Definition phar.c:3346
void phar_flush(phar_archive_data *phar, char **error)
Definition phar.c:2524
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)
Definition phar.c:2240
void phar_request_initialize(void)
Definition phar.c:3446
void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, size_t filename_len)
Definition util.c:2039
#define PHAR_ENT_PERM_DEF_DIR
phar_entry_info * phar_get_entry_info_dir(phar_archive_data *phar, char *path, size_t path_len, char dir, char **error, int security)
Definition util.c:1267
#define PHAR_G(v)
struct _phar_archive_data phar_archive_data
struct _phar_entry_info phar_entry_info
zend_result phar_get_archive(phar_archive_data **archive, char *fname, size_t fname_len, char *alias, size_t alias_len, char **error)
Definition util.c:1013
#define TAR_DIR
#define PHP_STRLCPY(dst, src, size, src_size)
Definition php.h:142
PHP_JSON_API size_t int options
Definition php_json.h:102
struct _php_stream php_stream
Definition php_streams.h:96
struct _php_stream_context php_stream_context
Definition php_streams.h:98
struct _php_stream_dirent php_stream_dirent
#define STREAMS_DC
Definition php_streams.h:53
#define php_stream_opendir(path, options, context)
struct _php_stream_ops php_stream_ops
struct _php_stream_wrapper php_stream_wrapper
Definition php_streams.h:97
#define php_stream_alloc(ops, thisptr, persistent_id, mode)
struct _php_stream_statbuf php_stream_statbuf
PHPAPI void php_stream_wrapper_log_error(const php_stream_wrapper *wrapper, int options, const char *fmt,...) PHP_ATTRIBUTE_FORMAT(printf
zend_constant * data
php_url * phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options)
Definition stream.c:60
zend_string * key
Definition zend_types.h:383
uint32_t is_modified
uint32_t is_crc_checked
uint32_t is_tar
uint32_t flags
uint32_t is_deleted
uint32_t is_dir
char * filename
uint32_t is_temp_dir
uint32_t old_flags
uint32_t is_zip
uint32_t is_mounted
char tar_type
char * tmp
phar_archive_data * phar
uint32_t filename_len
void * abstract
uint32_t nNumOfElements
Definition zend_types.h:407
Definition dce.c:49
char d_name[1]
Definition readdir.h:29
Definition url.h:20
zend_string * host
Definition url.h:24
zend_string * scheme
Definition url.h:21
zend_string * path
Definition url.h:26
PHPAPI void php_url_free(php_url *theurl)
Definition url.c:32
#define estrndup(s, length)
Definition zend_alloc.h:165
#define efree(ptr)
Definition zend_alloc.h:155
#define estrdup(s)
Definition zend_alloc.h:164
#define FREE_HASHTABLE(ht)
Definition zend_alloc.h:234
#define safe_emalloc(nmemb, size, offset)
Definition zend_alloc.h:154
#define ALLOC_HASHTABLE(ht)
Definition zend_alloc.h:231
struct _zval_struct zval
strlen(string $string)
strncmp(string $string1, string $string2, int $length)
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
Definition zend_hash.c:1727
ZEND_API zval *ZEND_FASTCALL zend_hash_str_update(HashTable *ht, const char *str, size_t len, zval *pData)
Definition zend_hash.c:1031
ZEND_API zend_result ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, size_t len)
Definition zend_hash.c:1661
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
Definition zend_hash.h:108
#define HASH_KEY_NON_EXISTENT
Definition zend_hash.h:31
#define HT_IS_INITIALIZED(ht)
Definition zend_hash.h:56
uint32_t zend_ulong
Definition zend_long.h:43
int32_t zend_off_t
Definition zend_long.h:44
struct _zend_string zend_string
ZEND_API int ZEND_FASTCALL zend_binary_strcmp(const char *s1, size_t len1, const char *s2, size_t len2)
#define ZEND_NORMALIZE_BOOL(n)
#define ZSTR_VAL(zstr)
Definition zend_string.h:68
#define ZSTR_LEN(zstr)
Definition zend_string.h:69
#define zend_string_equals_literal_ci(str, c)
#define ZVAL_NULL(z)
struct _zend_array HashTable
Definition zend_types.h:386
@ FAILURE
Definition zend_types.h:61
struct _Bucket Bucket
#define IS_SLASH(c)
bool result
zval * ret