summaryrefslogtreecommitdiff
path: root/ext/standard/streamsfuncs.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/streamsfuncs.c')
-rw-r--r--ext/standard/streamsfuncs.c93
1 files changed, 45 insertions, 48 deletions
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 24d8357d7f..1f84b486fc 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -49,7 +47,7 @@ static php_stream_context *decode_context_param(zval *contextresource);
/* Streams based network functions */
#if HAVE_SOCKETPAIR
-/* {{{ proto array stream_socket_pair(int domain, int type, int protocol)
+/* {{{ proto array|false stream_socket_pair(int domain, int type, int protocol)
Creates a pair of connected, indistinguishable socket streams */
PHP_FUNCTION(stream_socket_pair)
{
@@ -61,7 +59,7 @@ PHP_FUNCTION(stream_socket_pair)
Z_PARAM_LONG(domain)
Z_PARAM_LONG(type)
Z_PARAM_LONG(protocol)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (0 != socketpair((int)domain, (int)type, (int)protocol, pair)) {
char errbuf[256];
@@ -86,7 +84,7 @@ PHP_FUNCTION(stream_socket_pair)
/* }}} */
#endif
-/* {{{ proto resource stream_socket_client(string remoteaddress [, int &errcode [, string &errstring [, double timeout [, int flags [, resource context]]]]])
+/* {{{ proto resource|false stream_socket_client(string remoteaddress [, int &errcode [, string &errstring [, double timeout [, int flags [, resource context]]]]])
Open a client connection to a remote address */
PHP_FUNCTION(stream_socket_client)
{
@@ -112,7 +110,7 @@ PHP_FUNCTION(stream_socket_client)
Z_PARAM_DOUBLE(timeout)
Z_PARAM_LONG(flags)
Z_PARAM_RESOURCE(zcontext)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
@@ -175,7 +173,7 @@ PHP_FUNCTION(stream_socket_client)
}
/* }}} */
-/* {{{ proto resource stream_socket_server(string localaddress [, int &errcode [, string &errstring [, int flags [, resource context]]]])
+/* {{{ proto resource|false stream_socket_server(string localaddress [, int &errcode [, string &errstring [, int flags [, resource context]]]])
Create a server socket bound to localaddress */
PHP_FUNCTION(stream_socket_server)
{
@@ -197,7 +195,7 @@ PHP_FUNCTION(stream_socket_server)
Z_PARAM_ZVAL(zerrstr)
Z_PARAM_LONG(flags)
Z_PARAM_RESOURCE(zcontext)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
@@ -240,7 +238,7 @@ PHP_FUNCTION(stream_socket_server)
}
/* }}} */
-/* {{{ proto resource stream_socket_accept(resource serverstream, [ double timeout [, string &peername ]])
+/* {{{ proto resource|false stream_socket_accept(resource serverstream, [ double timeout [, string &peername ]])
Accept a client connection from a server socket */
PHP_FUNCTION(stream_socket_accept)
{
@@ -258,7 +256,7 @@ PHP_FUNCTION(stream_socket_accept)
Z_PARAM_OPTIONAL
Z_PARAM_DOUBLE(timeout)
Z_PARAM_ZVAL(zpeername)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -293,7 +291,7 @@ PHP_FUNCTION(stream_socket_accept)
}
/* }}} */
-/* {{{ proto string stream_socket_get_name(resource stream, bool want_peer)
+/* {{{ proto string|false stream_socket_get_name(resource stream, bool want_peer)
Returns either the locally bound or remote name for a socket stream */
PHP_FUNCTION(stream_socket_get_name)
{
@@ -305,7 +303,7 @@ PHP_FUNCTION(stream_socket_get_name)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zstream)
Z_PARAM_BOOL(want_peer)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -325,7 +323,7 @@ PHP_FUNCTION(stream_socket_get_name)
}
/* }}} */
-/* {{{ proto int stream_socket_sendto(resource stream, string data [, int flags [, string target_addr]])
+/* {{{ proto int|false stream_socket_sendto(resource stream, string data [, int flags [, string target_addr]])
Send data to a socket stream. If target_addr is specified it must be in dotted quad (or [ipv6]) format */
PHP_FUNCTION(stream_socket_sendto)
{
@@ -343,7 +341,7 @@ PHP_FUNCTION(stream_socket_sendto)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(flags)
Z_PARAM_STRING(target_addr, target_addr_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
if (target_addr_len) {
@@ -358,7 +356,7 @@ PHP_FUNCTION(stream_socket_sendto)
}
/* }}} */
-/* {{{ proto string stream_socket_recvfrom(resource stream, int amount [, int flags [, string &remote_addr]])
+/* {{{ proto string|false stream_socket_recvfrom(resource stream, int amount [, int flags [, string &remote_addr]])
Receives data from a socket stream */
PHP_FUNCTION(stream_socket_recvfrom)
{
@@ -376,7 +374,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(flags)
Z_PARAM_ZVAL(zremote)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -409,7 +407,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
}
/* }}} */
-/* {{{ proto string stream_get_contents(resource source [, int maxlen [, int offset]])
+/* {{{ proto string|false stream_get_contents(resource source [, int maxlen [, int offset]])
Reads all remaining bytes (or up to maxlen bytes) from a stream and returns them as a string. */
PHP_FUNCTION(stream_get_contents)
{
@@ -424,7 +422,7 @@ PHP_FUNCTION(stream_get_contents)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(maxlen)
Z_PARAM_LONG(desiredpos)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zsrc);
@@ -460,7 +458,7 @@ PHP_FUNCTION(stream_get_contents)
}
/* }}} */
-/* {{{ proto int stream_copy_to_stream(resource source, resource dest [, int maxlen [, int pos]])
+/* {{{ proto int|false stream_copy_to_stream(resource source, resource dest [, int maxlen [, int pos]])
Reads up to maxlen bytes from source stream and writes them to dest stream. */
PHP_FUNCTION(stream_copy_to_stream)
{
@@ -476,7 +474,7 @@ PHP_FUNCTION(stream_copy_to_stream)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(maxlen)
Z_PARAM_LONG(pos)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(src, zsrc);
php_stream_from_zval(dest, zdest);
@@ -495,7 +493,7 @@ PHP_FUNCTION(stream_copy_to_stream)
}
/* }}} */
-/* {{{ proto array stream_get_meta_data(resource fp)
+/* {{{ proto array|false stream_get_meta_data(resource fp)
Retrieves header/meta data from streams/file pointers */
PHP_FUNCTION(stream_get_meta_data)
{
@@ -552,7 +550,7 @@ PHP_FUNCTION(stream_get_meta_data)
}
/* }}} */
-/* {{{ proto array stream_get_transports()
+/* {{{ proto array|false stream_get_transports()
Retrieves list of registered socket transports */
PHP_FUNCTION(stream_get_transports)
{
@@ -574,7 +572,7 @@ PHP_FUNCTION(stream_get_transports)
}
/* }}} */
-/* {{{ proto array stream_get_wrappers()
+/* {{{ proto array|false stream_get_wrappers()
Retrieves list of registered stream wrappers */
PHP_FUNCTION(stream_get_wrappers)
{
@@ -738,7 +736,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array)
}
/* }}} */
-/* {{{ proto int stream_select(array &read_streams, array &write_streams, array &except_streams, int tv_sec[, int tv_usec])
+/* {{{ proto int|false stream_select(array &read_streams, array &write_streams, array &except_streams, int tv_sec[, int tv_usec])
Runs the select() system call on the sets of streams with a timeout specified by tv_sec and tv_usec */
PHP_FUNCTION(stream_select)
{
@@ -959,7 +957,7 @@ static php_stream_context *decode_context_param(zval *contextresource)
}
/* }}} */
-/* {{{ proto array stream_context_get_options(resource context|resource stream)
+/* {{{ proto array|false stream_context_get_options(resource context|resource stream)
Retrieve options for a stream/wrapper/context */
PHP_FUNCTION(stream_context_get_options)
{
@@ -968,7 +966,7 @@ PHP_FUNCTION(stream_context_get_options)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zcontext)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = decode_context_param(zcontext);
if (!context) {
@@ -993,7 +991,7 @@ PHP_FUNCTION(stream_context_set_option)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zcontext)
Z_PARAM_ARRAY(options)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* figure out where the context is coming from exactly */
if (!(context = decode_context_param(zcontext))) {
@@ -1012,7 +1010,7 @@ PHP_FUNCTION(stream_context_set_option)
Z_PARAM_STRING(wrappername, wrapperlen)
Z_PARAM_STRING(optionname, optionlen)
Z_PARAM_ZVAL(zvalue)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* figure out where the context is coming from exactly */
if (!(context = decode_context_param(zcontext))) {
@@ -1035,7 +1033,7 @@ PHP_FUNCTION(stream_context_set_params)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zcontext)
Z_PARAM_ARRAY(params)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = decode_context_param(zcontext);
if (!context) {
@@ -1047,7 +1045,7 @@ PHP_FUNCTION(stream_context_set_params)
}
/* }}} */
-/* {{{ proto array stream_context_get_params(resource context|resource stream)
+/* {{{ proto array|false stream_context_get_params(resource context|resource stream)
Get parameters of a file context */
PHP_FUNCTION(stream_context_get_params)
{
@@ -1056,7 +1054,7 @@ PHP_FUNCTION(stream_context_get_params)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zcontext)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = decode_context_param(zcontext);
if (!context) {
@@ -1084,7 +1082,7 @@ PHP_FUNCTION(stream_context_get_default)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY(params)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (FG(default_context) == NULL) {
FG(default_context) = php_stream_context_alloc();
@@ -1132,7 +1130,7 @@ PHP_FUNCTION(stream_context_create)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY_EX(options, 1, 0)
Z_PARAM_ARRAY_EX(params, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_alloc();
@@ -1166,7 +1164,7 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(read_write)
Z_PARAM_ZVAL(filterparams)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -1253,7 +1251,7 @@ PHP_FUNCTION(stream_filter_remove)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zfilter)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
filter = zend_fetch_resource(Z_RES_P(zfilter), NULL, php_file_le_stream_filter());
if (!filter) {
@@ -1292,7 +1290,7 @@ PHP_FUNCTION(stream_get_line)
Z_PARAM_LONG(max_length)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(str, str_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (max_length < 0) {
php_error_docref(NULL, E_WARNING, "The maximum allowed length must be greater than or equal to zero");
@@ -1399,7 +1397,7 @@ PHP_FUNCTION(stream_set_write_buffer)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(arg1)
Z_PARAM_LONG(arg2)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, arg1);
@@ -1428,7 +1426,7 @@ PHP_FUNCTION(stream_set_chunk_size)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zstream)
Z_PARAM_LONG(csize)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (csize <= 0) {
php_error_docref(NULL, E_WARNING, "The chunk size must be a positive integer, given " ZEND_LONG_FMT, csize);
@@ -1464,7 +1462,7 @@ PHP_FUNCTION(stream_set_read_buffer)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(arg1)
Z_PARAM_LONG(arg2)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, arg1);
@@ -1497,7 +1495,7 @@ PHP_FUNCTION(stream_socket_enable_crypto)
Z_PARAM_OPTIONAL
Z_PARAM_LONG_EX(cryptokind, cryptokindnull, 1, 0)
Z_PARAM_RESOURCE(zsessstream)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -1536,7 +1534,7 @@ PHP_FUNCTION(stream_socket_enable_crypto)
}
/* }}} */
-/* {{{ proto string stream_resolve_include_path(string filename)
+/* {{{ proto string|false stream_resolve_include_path(string filename)
Determine what file will be opened by calls to fopen() with a relative path */
PHP_FUNCTION(stream_resolve_include_path)
{
@@ -1567,7 +1565,7 @@ PHP_FUNCTION(stream_is_local)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(zstream)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(zstream) == IS_RESOURCE) {
php_stream_from_zval(stream, zstream);
@@ -1600,7 +1598,7 @@ PHP_FUNCTION(stream_supports_lock)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zsrc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zsrc);
@@ -1622,7 +1620,7 @@ PHP_FUNCTION(stream_isatty)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zsrc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zsrc);
@@ -1666,7 +1664,7 @@ PHP_FUNCTION(sapi_windows_vt100_support)
Z_PARAM_RESOURCE(zsrc)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(enable)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zsrc);
@@ -1677,8 +1675,7 @@ PHP_FUNCTION(sapi_windows_vt100_support)
php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)&fileno, 0);
}
else {
- zend_internal_type_error(
- ZEND_ARG_USES_STRICT_TYPES(),
+ zend_type_error(
"%s() was not able to analyze the specified stream",
get_active_function_name()
);
@@ -1727,7 +1724,7 @@ PHP_FUNCTION(stream_socket_shutdown)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zstream)
Z_PARAM_LONG(how)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (how != STREAM_SHUT_RD &&
how != STREAM_SHUT_WR &&