php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
bz2.c
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Author: Sterling Hughes <sterling@php.net> |
14 +----------------------------------------------------------------------+
15*/
16
17#ifdef HAVE_CONFIG_H
18#include <config.h>
19#endif
20
21#include "php.h"
22#include "php_bz2.h"
23#include "bz2_arginfo.h"
24
25#ifdef HAVE_BZ2
26
27/* PHP Includes */
28#include "ext/standard/info.h"
29#include "main/php_network.h"
30
31/* for fileno() */
32#include <stdio.h>
33
34/* Internal error constants */
35#define PHP_BZ_ERRNO 0
36#define PHP_BZ_ERRSTR 1
37#define PHP_BZ_ERRBOTH 2
38
39static PHP_MINIT_FUNCTION(bz2);
40static PHP_MSHUTDOWN_FUNCTION(bz2);
41static PHP_MINFO_FUNCTION(bz2);
42
43zend_module_entry bz2_module_entry = {
45 "bz2",
46 ext_functions,
47 PHP_MINIT(bz2),
48 PHP_MSHUTDOWN(bz2),
49 NULL,
50 NULL,
51 PHP_MINFO(bz2),
54};
55
56#ifdef COMPILE_DL_BZ2
58#endif
59
60struct php_bz2_stream_data_t {
61 BZFILE *bz_file;
62 php_stream *stream;
63};
64
65/* {{{ BZip2 stream implementation */
66
67static ssize_t php_bz2iop_read(php_stream *stream, char *buf, size_t count)
68{
69 struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
70 size_t ret = 0;
71
72 do {
73 int just_read;
74 size_t remain = count - ret;
75 int to_read = (int)(remain <= INT_MAX ? remain : INT_MAX);
76
77 just_read = BZ2_bzread(self->bz_file, buf, to_read);
78
79 if (just_read < 1) {
80 /* it is not safe to keep reading after an error, see #72613 */
81 stream->eof = 1;
82 if (just_read < 0) {
83 if (ret) {
84 return ret;
85 }
86 return -1;
87 }
88 break;
89 }
90
91 ret += just_read;
92 } while (ret < count);
93
94 return ret;
95}
96
97static ssize_t php_bz2iop_write(php_stream *stream, const char *buf, size_t count)
98{
99 size_t wrote = 0;
100 struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
101
102 do {
103 int just_wrote;
104 size_t remain = count - wrote;
105 int to_write = (int)(remain <= INT_MAX ? remain : INT_MAX);
106
107 just_wrote = BZ2_bzwrite(self->bz_file, (char*)buf, to_write);
108 if (just_wrote < 0) {
109 if (wrote == 0) {
110 return just_wrote;
111 }
112 return wrote;
113 }
114 if (just_wrote == 0) {
115 break;
116 }
117
118 wrote += just_wrote;
119
120 } while (wrote < count);
121
122 return wrote;
123}
124
125static int php_bz2iop_close(php_stream *stream, int close_handle)
126{
127 struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
128 int ret = EOF;
129
130 if (close_handle) {
131 BZ2_bzclose(self->bz_file);
132 }
133
134 if (self->stream) {
135 php_stream_free(self->stream, PHP_STREAM_FREE_CLOSE | (close_handle == 0 ? PHP_STREAM_FREE_PRESERVE_HANDLE : 0));
136 }
137
138 efree(self);
139
140 return ret;
141}
142
143static int php_bz2iop_flush(php_stream *stream)
144{
145 struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
146 return BZ2_bzflush(self->bz_file);
147}
148/* }}} */
149
151 php_bz2iop_write, php_bz2iop_read,
152 php_bz2iop_close, php_bz2iop_flush,
153 "BZip2",
154 NULL, /* seek */
155 NULL, /* cast */
156 NULL, /* stat */
157 NULL /* set_option */
158};
159
160/* {{{ Bzip2 stream openers */
162 const char *mode, php_stream *innerstream STREAMS_DC)
163{
164 struct php_bz2_stream_data_t *self;
165
166 self = emalloc(sizeof(*self));
167
168 self->stream = innerstream;
169 if (innerstream) {
170 GC_ADDREF(innerstream->res);
171 }
172 self->bz_file = bz;
173
175}
176
178 const char *path,
179 const char *mode,
180 int options,
181 zend_string **opened_path,
183{
184 php_stream *retstream = NULL, *stream = NULL;
185 char *path_copy = NULL;
186 BZFILE *bz_file = NULL;
187
188 if (strncasecmp("compress.bzip2://", path, 17) == 0) {
189 path += 17;
190 }
191 if (mode[0] == '\0' || (mode[0] != 'w' && mode[0] != 'r' && mode[1] != '\0')) {
192 return NULL;
193 }
194
195#ifdef VIRTUAL_DIR
196 virtual_filepath_ex(path, &path_copy, NULL);
197#else
198 path_copy = (char *)path;
199#endif
200
201 if (php_check_open_basedir(path_copy)) {
202#ifdef VIRTUAL_DIR
203 efree(path_copy);
204#endif
205 return NULL;
206 }
207
208 /* try and open it directly first */
209 bz_file = BZ2_bzopen(path_copy, mode);
210
211 if (opened_path && bz_file) {
212 *opened_path = zend_string_init(path_copy, strlen(path_copy), 0);
213 }
214
215#ifdef VIRTUAL_DIR
216 efree(path_copy);
217#endif
218
219 if (bz_file == NULL) {
220 /* that didn't work, so try and get something from the network/wrapper */
221 stream = php_stream_open_wrapper(path, mode, options | STREAM_WILL_CAST, opened_path);
222
223 if (stream) {
225 if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) {
226 bz_file = BZ2_bzdopen((int)fd, mode);
227 }
228 }
229
230 /* remove the file created by php_stream_open_wrapper(), it is not needed since BZ2 functions
231 * failed.
232 */
233 if (opened_path && !bz_file && mode[0] == 'w') {
234 VCWD_UNLINK(ZSTR_VAL(*opened_path));
235 }
236 }
237
238 if (bz_file) {
239 retstream = _php_stream_bz2open_from_BZFILE(bz_file, mode, stream STREAMS_REL_CC);
240 if (retstream) {
241 return retstream;
242 }
243
244 BZ2_bzclose(bz_file);
245 }
246
247 if (stream) {
248 php_stream_close(stream);
249 }
250
251 return NULL;
252}
253
254/* }}} */
255
256static const php_stream_wrapper_ops bzip2_stream_wops = {
258 NULL, /* close */
259 NULL, /* fstat */
260 NULL, /* stat */
261 NULL, /* opendir */
262 "BZip2",
263 NULL, /* unlink */
264 NULL, /* rename */
265 NULL, /* mkdir */
266 NULL, /* rmdir */
267 NULL
268};
269
270static const php_stream_wrapper php_stream_bzip2_wrapper = {
271 &bzip2_stream_wops,
272 NULL,
273 0 /* is_url */
274};
275
276static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int);
277
278static PHP_MINIT_FUNCTION(bz2)
279{
280 php_register_url_stream_wrapper("compress.bzip2", &php_stream_bzip2_wrapper);
282 return SUCCESS;
283}
284
285static PHP_MSHUTDOWN_FUNCTION(bz2)
286{
287 php_unregister_url_stream_wrapper("compress.bzip2");
289
290 return SUCCESS;
291}
292
293static PHP_MINFO_FUNCTION(bz2)
294{
296 php_info_print_table_row(2, "BZip2 Support", "Enabled");
297 php_info_print_table_row(2, "Stream Wrapper support", "compress.bzip2://");
298 php_info_print_table_row(2, "Stream Filter support", "bzip2.decompress, bzip2.compress");
299 php_info_print_table_row(2, "BZip2 Version", (char *) BZ2_bzlibVersion());
301}
302
303/* {{{ Reads up to length bytes from a BZip2 stream, or 1024 bytes if length is not specified */
305{
306 zval *bz;
307 zend_long len = 1024;
308 php_stream *stream;
310
311 if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &bz, &len)) {
313 }
314
315 php_stream_from_zval(stream, bz);
316
317 if (len < 0) {
318 zend_argument_value_error(2, "must be greater than or equal to 0");
320 }
321
323 if (!data) {
325 }
327}
328/* }}} */
329
330/* {{{ Opens a new BZip2 stream */
332{
333 zval *file; /* The file to open */
334 char *mode; /* The mode to open the stream with */
335 size_t mode_len;
336
337 BZFILE *bz; /* The compressed file stream */
338 php_stream *stream = NULL;
339
342 }
343
344 if (mode_len != 1 || (mode[0] != 'r' && mode[0] != 'w')) {
345 zend_argument_value_error(2, "must be either \"r\" or \"w\"");
347 }
348
349 /* If it's not a resource its a string containing the filename to open */
350 if (Z_TYPE_P(file) == IS_STRING) {
351 if (Z_STRLEN_P(file) == 0) {
354 }
355
357 zend_argument_type_error(1, "must not contain null bytes");
359 }
360
362 } else if (Z_TYPE_P(file) == IS_RESOURCE) {
363 /* If it is a resource, than its a stream resource */
365 size_t stream_mode_len;
366
367 php_stream_from_zval(stream, file);
368 stream_mode_len = strlen(stream->mode);
369
370 if (stream_mode_len != 1 && !(stream_mode_len == 2 && memchr(stream->mode, 'b', 2))) {
371 php_error_docref(NULL, E_WARNING, "Cannot use stream opened in mode '%s'", stream->mode);
373 } else if (stream_mode_len == 1 && stream->mode[0] != 'r' && stream->mode[0] != 'w' && stream->mode[0] != 'a' && stream->mode[0] != 'x') {
374 php_error_docref(NULL, E_WARNING, "Cannot use stream opened in mode '%s'", stream->mode);
376 }
377
378 switch(mode[0]) {
379 case 'r':
380 /* only "r" and "rb" are supported */
381 if (stream->mode[0] != mode[0] && !(stream_mode_len == 2 && stream->mode[1] != mode[0])) {
382 php_error_docref(NULL, E_WARNING, "Cannot read from a stream opened in write only mode");
384 }
385 break;
386 case 'w':
387 /* support only "w"(b), "a"(b), "x"(b) */
388 if (stream->mode[0] != mode[0] && !(stream_mode_len == 2 && stream->mode[1] != mode[0])
389 && stream->mode[0] != 'a' && !(stream_mode_len == 2 && stream->mode[1] != 'a')
390 && stream->mode[0] != 'x' && !(stream_mode_len == 2 && stream->mode[1] != 'x')) {
391 php_error_docref(NULL, E_WARNING, "cannot write to a stream opened in read only mode");
393 }
394 break;
396 }
397
398 if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_FD, (void *) &fd, REPORT_ERRORS)) {
400 }
401
402 bz = BZ2_bzdopen((int)fd, mode);
403
404 stream = php_stream_bz2open_from_BZFILE(bz, mode, stream);
405 } else {
406 zend_argument_type_error(1, "must be of type string or file-resource, %s given", zend_zval_value_name(file));
408 }
409
410 if (stream) {
412 } else {
414 }
415}
416/* }}} */
417
418/* {{{ Returns the error number */
420{
421 php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRNO);
422}
423/* }}} */
424
425/* {{{ Returns the error string */
427{
428 php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRSTR);
429}
430/* }}} */
431
432/* {{{ Returns the error number and error string in an associative array */
434{
435 php_bz2_error(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_BZ_ERRBOTH);
436}
437/* }}} */
438
439/* {{{ Compresses a string into BZip2 encoded data */
441{
442 char *source; /* Source data to compress */
443 zend_long zblock_size = 0; /* Optional block size to use */
444 zend_long zwork_factor = 0;/* Optional work factor to use */
445 zend_string *dest = NULL; /* Destination to place the compressed data into */
446 int error, /* Error Container */
447 block_size = 4, /* Block size for compression algorithm */
448 work_factor = 0, /* Work factor for compression algorithm */
449 argc = ZEND_NUM_ARGS(); /* Argument count */
450 size_t source_len; /* Length of the source data */
451 unsigned int dest_len; /* Length of the destination buffer */
452
453 if (zend_parse_parameters(argc, "s|ll", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) {
455 }
456
457 /* Assign them to easy to use variables, dest_len is initially the length of the data
458 + .01 x length of data + 600 which is the largest size the results of the compression
459 could possibly be, at least that's what the libbz2 docs say (thanks to jeremy@nirvani.net
460 for pointing this out). */
461 dest_len = (unsigned int) (source_len + (0.01 * source_len) + 600);
462
463 /* Allocate the destination buffer */
464 dest = zend_string_alloc(dest_len, 0);
465
466 /* Handle the optional arguments */
467 if (argc > 1) {
468 block_size = zblock_size;
469 }
470
471 if (argc > 2) {
472 work_factor = zwork_factor;
473 }
474
475 error = BZ2_bzBuffToBuffCompress(ZSTR_VAL(dest), &dest_len, source, source_len, block_size, 0, work_factor);
476 if (error != BZ_OK) {
477 zend_string_efree(dest);
479 } else {
480 /* Copy the buffer, we have perhaps allocate a lot more than we need,
481 so we erealloc() the buffer to the proper size */
482 ZSTR_LEN(dest) = dest_len;
483 ZSTR_VAL(dest)[ZSTR_LEN(dest)] = '\0';
484 RETURN_NEW_STR(dest);
485 }
486}
487/* }}} */
488
489/* {{{ Decompresses BZip2 compressed data */
491{
492 char *source;
493 zend_string *dest;
494 size_t source_len;
495 int error;
496 bool small = 0;
497#ifdef PHP_WIN32
498 unsigned __int64 size = 0;
499#else
500 unsigned long long size = 0;
501#endif
502 bz_stream bzs;
503
504 if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &source, &source_len, &small)) {
506 }
507
508 bzs.bzalloc = NULL;
509 bzs.bzfree = NULL;
510
511 if (BZ2_bzDecompressInit(&bzs, 0, (int)small) != BZ_OK) {
513 }
514
515 bzs.next_in = source;
516 bzs.avail_in = source_len;
517
518 /* in most cases bz2 offers at least 2:1 compression, so we use that as our base */
519 dest = zend_string_safe_alloc(source_len, 2, 1, 0);
520 bzs.avail_out = source_len * 2;
521 bzs.next_out = ZSTR_VAL(dest);
522
523 while ((error = BZ2_bzDecompress(&bzs)) == BZ_OK && bzs.avail_in > 0) {
524 /* compression is better then 2:1, need to allocate more memory */
525 bzs.avail_out = source_len;
526 size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
527#ifndef ZEND_ENABLE_ZVAL_LONG64
528 if (size > SIZE_MAX) {
529 /* no reason to continue if we're going to drop it anyway */
530 break;
531 }
532#endif
533 dest = zend_string_safe_realloc(dest, 1, bzs.avail_out+1, (size_t) size, 0);
534 bzs.next_out = ZSTR_VAL(dest) + size;
535 }
536
537 if (error == BZ_STREAM_END || error == BZ_OK) {
538 size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
539#ifndef ZEND_ENABLE_ZVAL_LONG64
540 if (UNEXPECTED(size > SIZE_MAX)) {
541 php_error_docref(NULL, E_WARNING, "Decompressed size too big, max is %zd", SIZE_MAX);
542 zend_string_efree(dest);
543 RETVAL_LONG(BZ_MEM_ERROR);
544 } else
545#endif
546 {
547 dest = zend_string_safe_realloc(dest, 1, (size_t)size, 1, 0);
548 ZSTR_LEN(dest) = (size_t)size;
549 ZSTR_VAL(dest)[(size_t)size] = '\0';
550 RETVAL_STR(dest);
551 }
552 } else { /* real error */
553 zend_string_efree(dest);
555 }
556
557 BZ2_bzDecompressEnd(&bzs);
558}
559/* }}} */
560
561/* {{{ php_bz2_error()
562 The central error handling interface, does the work for bzerrno, bzerrstr and bzerror */
563static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
564{
565 zval *bzp; /* BZip2 Resource Pointer */
566 php_stream *stream;
567 const char *errstr; /* Error string */
568 int errnum; /* Error number */
569 struct php_bz2_stream_data_t *self;
570
571 if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &bzp) == FAILURE) {
573 }
574
575 php_stream_from_zval(stream, bzp);
576
577 if (!php_stream_is(stream, PHP_STREAM_IS_BZIP2)) {
578 zend_argument_type_error(1, "must be a bz2 stream");
580 }
581
582 self = (struct php_bz2_stream_data_t *) stream->abstract;
583
584 /* Fetch the error information */
585 errstr = BZ2_bzerror(self->bz_file, &errnum);
586
587 /* Determine what to return */
588 switch (opt) {
589 case PHP_BZ_ERRNO:
590 RETURN_LONG(errnum);
591 break;
592 case PHP_BZ_ERRSTR:
593 RETURN_STRING((char*)errstr);
594 break;
595 case PHP_BZ_ERRBOTH:
597
598 add_assoc_long (return_value, "errno", errnum);
599 add_assoc_string(return_value, "errstr", (char*)errstr);
600 break;
601 }
602}
603/* }}} */
604
605#endif
size_t len
Definition apprentice.c:174
file(string $filename, int $flags=0, $context=null)
count(Countable|array $value, int $mode=COUNT_NORMAL)
bzerrno($bz)
Definition bz2.stub.php:33
bzerror($bz)
Definition bz2.stub.php:43
bzcompress(string $data, int $block_size=4, int $work_factor=0)
Definition bz2.stub.php:45
bzread($bz, int $length=1024)
Definition bz2.stub.php:12
bzerrstr($bz)
Definition bz2.stub.php:36
bzdecompress(string $data, bool $use_less_memory=false)
Definition bz2.stub.php:47
bzopen($file, string $mode)
Definition bz2.stub.php:9
const php_stream_filter_factory php_bz2_filter_factory
Definition bz2_filter.c:405
error($message)
Definition ext_skel.php:22
new_type size
Definition ffi.c:4365
zend_ffi_ctype_name_buf buf
Definition ffi.c:4685
PHPAPI int php_check_open_basedir(const char *path)
size_t mode_len
char * mode
#define SIZE_MAX
Definition funcs.c:51
#define NULL
Definition gdcache.h:45
#define SUCCESS
Definition hash_sha3.c:261
PHPAPI int php_stream_filter_register_factory(const char *filterpattern, const php_stream_filter_factory *factory)
Definition filter.c:43
PHPAPI int php_stream_filter_unregister_factory(const char *filterpattern)
Definition filter.c:52
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format,...)
Definition main.c:1173
php_info_print_table_start()
Definition info.c:1064
php_info_print_table_row(2, "PDO Driver for Firebird", "enabled")
php_info_print_table_end()
Definition info.c:1074
#define PHP_FUNCTION
Definition php.h:364
#define PHP_MSHUTDOWN_FUNCTION
Definition php.h:401
#define PHP_MINFO
Definition php.h:396
#define PHP_MINIT_FUNCTION
Definition php.h:400
#define PHP_MSHUTDOWN
Definition php.h:393
#define PHP_MINFO_FUNCTION
Definition php.h:404
#define INT_MAX
Definition php.h:237
#define PHP_MINIT
Definition php.h:392
#define PHP_STREAM_IS_BZIP2
Definition php_bz2.h:57
#define php_stream_bz2open(wrapper, path, mode, options, opened_path)
Definition php_bz2.h:53
#define php_stream_bz2open_from_BZFILE(bz, mode, innerstream)
Definition php_bz2.h:52
#define PHP_BZ2_VERSION
Definition php_bz2.h:47
#define PHP_BZ2_API
Definition php_bz2.h:43
PHP_BZ2_API php_stream * _php_stream_bz2open_from_BZFILE(BZFILE *bz, const char *mode, php_stream *innerstream STREAMS_DC)
PHP_BZ2_API php_stream * _php_stream_bz2open(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC)
const php_stream_ops php_stream_bz2io_ops
PHP_JSON_API size_t int options
Definition php_json.h:102
int php_socket_t
#define php_stream_cast(stream, as, ret, show_err)
struct _php_stream_wrapper_ops php_stream_wrapper_ops
struct _php_stream php_stream
Definition php_streams.h:96
struct _php_stream_context php_stream_context
Definition php_streams.h:98
#define REPORT_ERRORS
#define php_stream_from_zval(xstr, pzval)
#define PHP_STREAM_FREE_PRESERVE_HANDLE
#define STREAMS_DC
Definition php_streams.h:53
#define php_stream_alloc_rel(ops, thisptr, persistent, mode)
Definition php_streams.h:60
PHPAPI zend_string * php_stream_read_to_str(php_stream *stream, size_t len)
Definition streams.c:792
#define php_stream_to_zval(stream, zval)
#define php_stream_free(stream, close_options)
#define php_stream_close(stream)
#define PHP_STREAM_FREE_CLOSE
#define STREAM_WILL_CAST
#define php_stream_is(stream, anops)
PHPAPI zend_result php_register_url_stream_wrapper(const char *protocol, const php_stream_wrapper *wrapper)
Definition streams.c:1911
struct _php_stream_ops php_stream_ops
#define php_stream_open_wrapper(path, mode, options, opened)
#define STREAMS_REL_CC
Definition php_streams.h:55
struct _php_stream_wrapper php_stream_wrapper
Definition php_streams.h:97
PHPAPI zend_result php_unregister_url_stream_wrapper(const char *protocol)
Definition streams.c:1927
#define PHP_STREAM_AS_FD
int fd
Definition phpdbg.h:282
zend_constant * data
void * abstract
char mode[16]
Definition dce.c:49
#define INTERNAL_FUNCTION_PARAMETERS
Definition zend.h:49
#define INTERNAL_FUNCTION_PARAM_PASSTHRU
Definition zend.h:50
ZEND_API const char * zend_zval_value_name(const zval *arg)
Definition zend_API.c:148
ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec,...)
Definition zend_API.c:1300
ZEND_API ZEND_COLD void zend_argument_must_not_be_empty_error(uint32_t arg_num)
Definition zend_API.c:443
ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *format,...)
Definition zend_API.c:433
ZEND_API ZEND_COLD void zend_argument_type_error(uint32_t arg_num, const char *format,...)
Definition zend_API.c:423
#define ZEND_NUM_ARGS()
Definition zend_API.h:530
#define RETURN_STRING(s)
Definition zend_API.h:1043
#define RETURN_FALSE
Definition zend_API.h:1058
#define ZEND_GET_MODULE(name)
Definition zend_API.h:241
#define RETURN_LONG(l)
Definition zend_API.h:1037
#define RETURN_NEW_STR(s)
Definition zend_API.h:1041
#define RETURN_THROWS()
Definition zend_API.h:1060
#define RETURN_STR(s)
Definition zend_API.h:1039
#define CHECK_ZVAL_NULL_PATH(p)
Definition zend_API.h:949
#define RETVAL_LONG(l)
Definition zend_API.h:1011
#define RETVAL_STR(s)
Definition zend_API.h:1013
#define array_init(arg)
Definition zend_API.h:537
#define efree(ptr)
Definition zend_alloc.h:155
#define emalloc(size)
Definition zend_alloc.h:151
struct _zval_struct zval
strlen(string $string)
#define strncasecmp(s1, s2, n)
#define E_WARNING
Definition zend_errors.h:24
int32_t zend_long
Definition zend_long.h:42
struct _zend_string zend_string
#define STANDARD_MODULE_HEADER
struct _zend_module_entry zend_module_entry
#define STANDARD_MODULE_PROPERTIES
#define EMPTY_SWITCH_DEFAULT_CASE()
#define UNEXPECTED(condition)
#define ZSTR_VAL(zstr)
Definition zend_string.h:68
#define ZSTR_LEN(zstr)
Definition zend_string.h:69
#define Z_TYPE_P(zval_p)
Definition zend_types.h:660
#define Z_STRVAL_P(zval_p)
Definition zend_types.h:975
#define IS_STRING
Definition zend_types.h:606
#define IS_RESOURCE
Definition zend_types.h:609
#define GC_ADDREF(p)
Definition zend_types.h:709
#define Z_STRLEN_P(zval_p)
Definition zend_types.h:978
@ FAILURE
Definition zend_types.h:61
CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path)
#define VCWD_UNLINK(path)
zval * return_value
zval * ret