From: Xinchen Hui Date: Sun, 18 May 2014 04:02:54 +0000 (+0800) Subject: Fixed several tests failes X-Git-Tag: POST_PHPNG_MERGE~328^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3cbdcdc2c8e7c88d448ac3d37109ac5981c3e9b9;p=php Fixed several tests failes --- diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index ff96e95c4c..05b3f9d51a 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -308,6 +308,7 @@ static long from_zval_integer_common(const zval *arr_value, ser_context *ctx) long ret = 0; zval lzval; + ZVAL_NULL(&lzval); if (Z_TYPE_P(arr_value) != IS_LONG) { ZVAL_COPY(&lzval, arr_value); arr_value = &lzval; @@ -926,7 +927,7 @@ static void from_zval_write_control_array(const zval *arr, char *msghdr_c, ser_c char buf[sizeof("element #4294967295")]; char *bufp = buf; zval *elem; - uint32_t i; + uint32_t i = 0; int num_elems; void *control_buf; zend_llist_element *alloc; diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 1237b6c39e..b858a4733e 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -1192,6 +1192,11 @@ PHP_FUNCTION(socket_getsockname) RETURN_FALSE; } + ZVAL_DEREF(addr); + if (port != NULL) { + ZVAL_DEREF(port); + } + switch (sa->sa_family) { #if HAVE_IPV6 case AF_INET6: @@ -2099,6 +2104,7 @@ PHP_FUNCTION(socket_create_pair) php_sock[0] = php_create_socket(); php_sock[1] = php_create_socket(); + ZVAL_DEREF(fds_array_zval); if (domain != AF_INET #if HAVE_IPV6 && domain != AF_INET6 diff --git a/ext/sockets/tests/socket_import_stream-2.phpt b/ext/sockets/tests/socket_import_stream-2.phpt index 085f0e3834..4f06bbd719 100644 --- a/ext/sockets/tests/socket_import_stream-2.phpt +++ b/ext/sockets/tests/socket_import_stream-2.phpt @@ -43,7 +43,7 @@ bool(false) resource(%d) of type (stream) bool(true) -Warning: socket_import_stream(): %d is not a valid stream resource in %s on line %d +Warning: socket_import_stream(): supplied resource is not a valid stream resource in %s on line %d bool(false) Done. diff --git a/ext/sockets/tests/socket_import_stream-4.phpt b/ext/sockets/tests/socket_import_stream-4.phpt index 8095d8dac7..4b645014d7 100644 --- a/ext/sockets/tests/socket_import_stream-4.phpt +++ b/ext/sockets/tests/socket_import_stream-4.phpt @@ -76,7 +76,7 @@ stream_set_blocking 1 close stream stream_set_blocking -Warning: stream_set_blocking(): %d is not a valid stream resource in %s on line %d +Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d socket_set_block Warning: socket_set_block(): unable to set blocking mode [%d]: %s in %s on line %d @@ -88,13 +88,13 @@ Warning: socket_get_option(): unable to retrieve socket option [%d]: %s in %s on close socket stream_set_blocking -Warning: stream_set_blocking(): %d is not a valid stream resource in %s on line %d +Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d socket_set_block -Warning: socket_set_block(): %d is not a valid Socket resource in %s on line %d +Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d socket_get_option -Warning: socket_get_option(): %d is not a valid Socket resource in %s on line %d +Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d Done. diff --git a/ext/sockets/tests/socket_set_block-retval.phpt b/ext/sockets/tests/socket_set_block-retval.phpt index 2aa4b0e5c4..88e0029989 100644 --- a/ext/sockets/tests/socket_set_block-retval.phpt +++ b/ext/sockets/tests/socket_set_block-retval.phpt @@ -21,7 +21,7 @@ var_dump(socket_set_block($socket2)); --EXPECTF-- bool(true) -Warning: socket_set_block(): %d is not a valid Socket resource in %s on line %d +Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d bool(false) --CREDITS-- Robin Mehner, robin@coding-robin.de diff --git a/ext/sockets/tests/socket_set_nonblock-retval.phpt b/ext/sockets/tests/socket_set_nonblock-retval.phpt index b90861859a..c9bb1150ab 100644 --- a/ext/sockets/tests/socket_set_nonblock-retval.phpt +++ b/ext/sockets/tests/socket_set_nonblock-retval.phpt @@ -21,7 +21,7 @@ var_dump(socket_set_nonblock($socket2)); --EXPECTF-- bool(true) -Warning: socket_set_nonblock(): %d is not a valid Socket resource in %s on line %d +Warning: socket_set_nonblock(): supplied resource is not a valid Socket resource in %s on line %d bool(false) --CREDITS-- Robin Mehner, robin@coding-robin.de