From: Colin Viebrock Date: Fri, 2 Feb 2001 20:55:27 +0000 (+0000) Subject: Fix for http://bugs.php.net/bugs.php?id=9082 X-Git-Tag: php-4.0.5RC1~385 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=96343bac9027b9cf6b2dd660521539fe7db3af05;p=php Fix for http://bugs.php.net/bugs.php?id=9082 I know switch() is expensive, so someone rewrite this "properly" if you want. --- diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 76203329d3..67ce0eef20 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -857,10 +857,27 @@ PHP_FUNCTION(getpeername) int salen = sizeof(php_sockaddr_storage); int ret; + switch (ZEND_NUM_ARGS()) { + case 3: + if (zend_get_parameters_ex(ZEND_NUM_ARGS(), &fd, &addr, &port) == FAILURE) + WRONG_PARAM_COUNT; + break; + case 2: + if (zend_get_parameters_ex(ZEND_NUM_ARGS(), &fd, &addr) == FAILURE) + WRONG_PARAM_COUNT; + break; + MAKE_STD_ZVAL((*port)); + + default: + WRONG_PARAM_COUNT; + } + +/* if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &fd, &addr, &port) == FAILURE) { WRONG_PARAM_COUNT; } +*/ multi_convert_to_long_ex(ZEND_NUM_ARGS() - 1, fd, port); convert_to_string_ex(addr);