mirror of
https://github.com/php/php-src.git
synced 2026-03-27 17:52:16 +01:00
- Allow resetting the module global last_error too.
This commit is contained in:
@@ -1939,18 +1939,21 @@ PHP_FUNCTION(socket_last_error)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void socket_clear_error(resource socket)
|
||||
Clears the error on the socket */
|
||||
Clears the error on the socket or the last error code. */
|
||||
PHP_FUNCTION(socket_clear_error)
|
||||
{
|
||||
zval *arg1;
|
||||
zval *arg1 = NULL;
|
||||
php_socket *php_sock;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &arg1) == FAILURE)
|
||||
return;
|
||||
|
||||
ZEND_FETCH_RESOURCE(php_sock, php_socket*, &arg1, -1, le_socket_name, le_socket);
|
||||
|
||||
php_sock->error = 0;
|
||||
if (arg1) {
|
||||
ZEND_FETCH_RESOURCE(php_sock, php_socket*, &arg1, -1, le_socket_name, le_socket);
|
||||
php_sock->error = 0;
|
||||
} else {
|
||||
SOCKETS_G(last_error) = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user