cvs: php4 /ext/standard basic_functions.c

From: Date: Fri, 07 Dec 2001 13:20:19 +0000
Subject: cvs: php4 /ext/standard basic_functions.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-8508@lists.php.net to get a copy of this message
sterling Fri Dec 7 08:20:19 2001 EDT Modified files: /php4/ext/standard basic_functions.c Log: Fix long2ip's handling of unsigned longs, by accepting a string argument and then manually converting the string to an unsigned long using strtoul() Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.427 php4/ext/standard/basic_functions.c:1.428 --- php4/ext/standard/basic_functions.c:1.427 Fri Dec 7 04:34:50 2001 +++ php4/ext/standard/basic_functions.c Fri Dec 7 08:20:18 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.427 2001/12/07 09:34:50 eschmid Exp $ */ +/* $Id: basic_functions.c,v 1.428 2001/12/07 13:20:18 sterling Exp $ */ #include "php.h" #include "php_main.h" @@ -1153,15 +1153,17 @@ PHP_FUNCTION(long2ip) { zval **num; + unsigned long n; struct in_addr myaddr; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) { WRONG_PARAM_COUNT; } + convert_to_string_ex(num); + + n = strtoul(Z_STRVAL_PP(num), NULL, 0); - convert_to_long_ex(num); - myaddr.s_addr = htonl((unsigned long) Z_LVAL_PP(num)); - + myaddr.s_addr = htonl(n); RETURN_STRING(inet_ntoa(myaddr), 1); } /* }}} */ @@ -2882,7 +2884,7 @@ * tab-width: 4 * c-basic-offset: 4 * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 + * vim600: fdm=marker + * vim: noet sw=4 ts=4 */

« previous php.cvs (#8508) next »