32static ssize_t php_stream_output_write(
php_stream *stream,
const char *
buf,
size_t count)
46static int php_stream_output_close(
php_stream *stream,
int close_handle)
53 php_stream_output_write,
54 php_stream_output_read,
55 php_stream_output_close,
70static ssize_t php_stream_input_write(
php_stream *stream,
const char *
buf,
size_t count)
98 if (!read || read == (
size_t) -1) {
108static int php_stream_input_close(
php_stream *stream,
int close_handle)
117static int php_stream_input_flush(
php_stream *stream)
138 php_stream_input_write,
139 php_stream_input_read,
140 php_stream_input_close,
141 php_stream_input_flush,
143 php_stream_input_seek,
149static void php_stream_apply_filter_list(
php_stream *stream,
char *filterlist,
int read_chain,
int write_chain)
151 char *
p, *token =
NULL;
182 char *
p, *token =
NULL, *pathdup;
186 int pipe_requested = 0;
199 if (max_memory < 0) {
227 input =
ecalloc(1,
sizeof(*input));
228 if ((input->
body =
SG(request_info).request_body)) {
232 SG(request_info).request_body = input->
body;
246 static int cli_in = 0;
262 static int cli_out = 0;
278 static int cli_err = 0;
316 "php://fd/ stream must be specified in the form php://fd/<orig fd>");
321 dtablesize = getdtablesize();
326 if (fildes_ori < 0 || fildes_ori >= dtablesize) {
328 "The file descriptors must be non-negative numbers smaller than %d", dtablesize);
332 fd = dup((
int)fildes_ori);
335 "Error duping file descriptor " ZEND_LONG_FMT "; possibly it doesn't exist: "
336 "[%d]: %s", fildes_ori,
errno, strerror(
errno));
348 p =
strstr(pathdup,
"/resource=");
365 php_stream_apply_filter_list(stream,
p + 5, 1, 0);
367 php_stream_apply_filter_list(stream,
p + 6, 0, 1);
393#if defined(S_IFSOCK) && !defined(PHP_WIN32)
396 memset(&st, 0,
sizeof(st));
397 if (
zend_fstat(
fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) {
411 if (stream ==
NULL) {
417 if (pipe_requested && stream &&
context) {
419 if (blocking_pipes) {
429 php_stream_url_wrap_php,
SAPI_API sapi_module_struct sapi_module
SAPI_API size_t sapi_read_post_block(char *buffer, size_t buflen)
#define SAPI_POST_BLOCK_SIZE
file(string $filename, int $flags=0, $context=null)
count(Countable|array $value, int $mode=COUNT_NORMAL)
strstr(string $haystack, string $needle, bool $before_needle=false)
strchr(string $haystack, string $needle, bool $before_needle=false)
memset(ptr, 0, type->size)
zend_ffi_ctype_name_buf buf
PHPAPI php_stream_filter * php_stream_filter_create(const char *filtername, zval *filterparams, uint8_t persistent)
PHPAPI size_t php_url_decode(char *str, size_t len)
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format,...)
unsigned const char * end
struct php_stream_input php_stream_input_t
PHPAPI const php_stream_wrapper php_stream_php_wrapper
PHP_JSON_API size_t int options
#define TEMP_STREAM_DEFAULT
#define php_stream_temp_create(mode, max_memory_usage)
#define PHP_STREAM_MAX_MEM
#define php_stream_memory_create(mode)
#define php_stream_temp_create_ex(mode, max_memory_usage, tmpdir)
PHPAPI int php_stream_mode_from_str(const char *mode)
#define php_stream_sock_open_from_socket(socket, persistent)
PHPAPI const php_stream_ops php_stream_socket_ops
#define PHPWRITE(str, str_len)
PHPAPI char * php_strtok_r(char *s, const char *delim, char **last)
PHPAPI zval * php_stream_context_get_option(php_stream_context *context, const char *wrappername, const char *optionname)
#define php_stream_filter_append(chain, filter)
#define PHP_STREAM_FILTER_WRITE
#define PHP_STREAM_FILTER_READ
#define php_stream_fopen_from_fd(fd, mode, persistent_id)
#define php_stream_fopen_from_file(file, mode)
struct _php_stream_wrapper_ops php_stream_wrapper_ops
struct _php_stream php_stream
struct _php_stream_context php_stream_context
#define php_stream_read(stream, buf, count)
struct _php_stream_filter php_stream_filter
#define php_stream_rewind(stream)
#define STREAM_OPEN_FOR_INCLUDE
#define php_stream_seek(stream, offset, whence)
#define php_stream_open_wrapper_ex(path, mode, options, opened, context)
#define php_stream_close(stream)
#define php_stream_is_persistent(stream)
struct _php_stream_ops php_stream_ops
struct _php_stream_wrapper php_stream_wrapper
#define php_stream_set_option(stream, option, value, ptrvalue)
#define php_stream_alloc(ops, thisptr, persistent_id, mode)
#define PHP_STREAM_OPTION_PIPE_BLOCKING
#define php_stream_write(stream, buf, count)
PHPAPI void php_stream_wrapper_log_error(const php_stream_wrapper *wrapper, int options, const char *fmt,...) PHP_ATTRIBUTE_FORMAT(printf
const php_stream_ops * ops
php_stream_filter_chain writefilters
php_stream_filter_chain readfilters
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *format,...)
#define estrndup(s, length)
#define ecalloc(nmemb, size)
strcmp(string $string1, string $string2)
#define strncasecmp(s1, s2, n)
#define strcasecmp(s1, s2)
#define ZEND_STRTOL(s0, s1, base)
struct _zend_string zend_string