summaryrefslogtreecommitdiff
path: root/ext/standard/fsock.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-01-07 12:28:51 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-01-11 15:49:06 +0100
commite219ec144ef6682b71e135fd18654ee1bb4676b4 (patch)
treee4a3ae2b619cdc9fe50ee8e1fa5adb99d804dddf /ext/standard/fsock.c
parentfe8fdfa3bd588d80ce60f6b3848058239e0a760f (diff)
downloadphp-git-e219ec144ef6682b71e135fd18654ee1bb4676b4.tar.gz
Implement typed properties
RFC: https://wiki.php.net/rfc/typed_properties_v2 This is a squash of PR #3734, which is a squash of PR #3313. Co-authored-by: Bob Weinand <bobwei9@hotmail.com> Co-authored-by: Joe Watkins <krakjoe@php.net> Co-authored-by: Dmitry Stogov <dmitry@zend.com>
Diffstat (limited to 'ext/standard/fsock.c')
-rw-r--r--ext/standard/fsock.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
index 6fc7143cd6..32e651d1e4 100644
--- a/ext/standard/fsock.c
+++ b/ext/standard/fsock.c
@@ -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,27 @@ 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);
+ }
+ 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);
}