diff options
Diffstat (limited to 'ext/standard/fsock.c')
-rw-r--r-- | ext/standard/fsock.c | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 6fc7143cd6..f896c70770 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -53,8 +53,8 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) Z_PARAM_STRING(host, host_len) Z_PARAM_OPTIONAL Z_PARAM_LONG(port) - Z_PARAM_ZVAL_DEREF(zerrno) - Z_PARAM_ZVAL_DEREF(zerrstr) + Z_PARAM_ZVAL(zerrno) + Z_PARAM_ZVAL(zerrstr) Z_PARAM_DOUBLE(timeout) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); @@ -79,15 +79,6 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) #endif tv.tv_usec = conv % 1000000; - if (zerrno) { - zval_ptr_dtor(zerrno); - ZVAL_LONG(zerrno, 0); - } - if (zerrstr) { - zval_ptr_dtor(zerrstr); - ZVAL_EMPTY_STRING(zerrstr); - } - stream = php_stream_xport_create(hostname, hostname_len, REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, hashkey, &tv, NULL, &errstr, &err); @@ -102,22 +93,28 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) efree(hashkey); } - if (stream == NULL) { + if (stream == NULL) { if (zerrno) { - zval_ptr_dtor(zerrno); - ZVAL_LONG(zerrno, err); + ZEND_TRY_ASSIGN_LONG(zerrno, err); } - if (zerrstr && errstr) { - /* no need to dup; we need to efree buf anyway */ - zval_ptr_dtor(zerrstr); - ZVAL_STR(zerrstr, errstr); - } else if (!zerrstr && errstr) { - zend_string_release_ex(errstr, 0); + if (errstr) { + if (zerrstr) { + ZEND_TRY_ASSIGN_STR(zerrstr, errstr); + } else { + zend_string_release(errstr); + } } RETURN_FALSE; } + if (zerrno) { + ZEND_TRY_ASSIGN_LONG(zerrno, 0); + } + if (zerrstr) { + ZEND_TRY_ASSIGN_EMPTY_STRING(zerrstr); + } + if (errstr) { zend_string_release_ex(errstr, 0); } @@ -142,12 +139,3 @@ PHP_FUNCTION(pfsockopen) php_fsockopen_stream(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ |