[PHP-CVS] cvs: php-src /ext/iconv iconv.c
pollita Mon Jan 21 07:30:49 2008 UTC Modified files: /php-src/ext/iconv iconv.c Log: Some unicode upgrades... http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/iconv.c?r1=1.163&r2=1.164&diff_format=u Index: php-src/ext/iconv/iconv.c diff -u php-src/ext/iconv/iconv.c:1.163 php-src/ext/iconv/iconv.c:1.164 --- php-src/ext/iconv/iconv.c:1.163 Mon Dec 31 07:12:10 2007 +++ php-src/ext/iconv/iconv.c Mon Jan 21 07:30:49 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: iconv.c,v 1.163 2007/12/31 07:12:10 sebastian Exp $ */ +/* $Id: iconv.c,v 1.164 2008/01/21 07:30:49 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1932,14 +1932,15 @@ } /* }}} */ -/* {{{ proto int iconv_strlen(string str [, string charset]) +/* {{{ proto int iconv_strlen(string str [, string charset]) U Returns the character count of str */ PHP_FUNCTION(iconv_strlen) { char *charset; int charset_len = 0; - char *str; - int str_len; + zstr str; + int str_len, argc = ZEND_NUM_ARGS(); + zend_uchar str_type; php_iconv_err_t err; @@ -1947,17 +1948,21 @@ charset = ICONVG(internal_encoding); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", - &str, &str_len, &charset, &charset_len) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "t|s", + &str, &str_len, &str_type, &charset, &charset_len) == FAILURE) { RETURN_FALSE; } + if (str_type == IS_UNICODE) { + RETURN_LONG(u_countChar32(str.u, str_len)); + } + if (charset_len >= ICONV_CSNMAXLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN); RETURN_FALSE; } - err = _php_iconv_strlen(&retval, str, str_len, charset); + err = _php_iconv_strlen(&retval, str.s, str_len, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS) { RETVAL_LONG(retval); @@ -1967,14 +1972,15 @@ } /* }}} */ -/* {{{ proto string iconv_substr(string str, int offset, [int length, string charset]) +/* {{{ proto string iconv_substr(string str, int offset, [int length, string charset]) U Returns specified part of a string */ PHP_FUNCTION(iconv_substr) { char *charset; int charset_len = 0; - char *str; + zstr str; int str_len; + zend_uchar str_type; long offset, length; php_iconv_err_t err; @@ -1983,8 +1989,8 @@ charset = ICONVG(internal_encoding); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", - &str, &str_len, &offset, &length, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "tl|ls", + &str, &str_len, &str_type, &offset, &length, &charset, &charset_len) == FAILURE) { RETURN_FALSE; } @@ -1998,10 +2004,38 @@ length = str_len; } - err = _php_iconv_substr(&retval, str, str_len, offset, length, charset); + if (str_type == IS_UNICODE) { + int start, end; + + if (offset >= 0) { + start = 0; + U16_FWD_N(str.u, start, str_len, offset); + } else { + start = str_len; + U16_BACK_N(str.u, start, str_len, -offset); + } + + if (length < 0) { + length += u_countChar32(str.u, str_len); + } + + end = start; + U16_FWD_N(str.u, end, str_len, length); + + if (start > str_len) { start = str_len; } + if (end > str_len) { end = str_len; } + + if (end > start) { + RETURN_UNICODEL(str.u + start, end - start, ZSTR_DUPLICATE); + } else { + RETURN_EMPTY_UNICODE(); + } + } + + err = _php_iconv_substr(&retval, str.s, str_len, offset, length, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); - if (err == PHP_ICONV_ERR_SUCCESS && str != NULL) { + if (err == PHP_ICONV_ERR_SUCCESS && str.s != NULL) { if (retval.c != NULL) { RETVAL_STRINGL(retval.c, retval.len, 0); } else { @@ -2014,16 +2048,18 @@ } /* }}} */ -/* {{{ proto int iconv_strpos(string haystack, string needle [, int offset [, string charset]]) +/* {{{ proto int iconv_strpos(string haystack, string needle [, int offset [, string charset]]) U Finds position of first occurrence of needle within part of haystack beginning with offset */ PHP_FUNCTION(iconv_strpos) { cha
[PHP-CVS] cvs: php-src /ext/calendar cal_unix.c easter.c
pollita Mon Jan 21 06:36:02 2008 UTC Modified files: /php-src/ext/calendar easter.c cal_unix.c Log: Flag additional unicode safe funcs http://cvs.php.net/viewvc.cgi/php-src/ext/calendar/easter.c?r1=1.22&r2=1.23&diff_format=u Index: php-src/ext/calendar/easter.c diff -u php-src/ext/calendar/easter.c:1.22 php-src/ext/calendar/easter.c:1.23 --- php-src/ext/calendar/easter.c:1.22 Mon Dec 31 07:12:07 2007 +++ php-src/ext/calendar/easter.c Mon Jan 21 06:36:02 2008 @@ -121,7 +121,7 @@ } -/* {{{ proto int easter_date([int year]) +/* {{{ proto int easter_date([int year]) U Return the timestamp of midnight on Easter of a given year (defaults to current year) */ PHP_FUNCTION(easter_date) { @@ -129,7 +129,7 @@ } /* }}} */ -/* {{{ proto int easter_days([int year, [int method]]) +/* {{{ proto int easter_days([int year, [int method]]) U Return the number of days after March 21 that Easter falls on for a given year (defaults to current year) */ PHP_FUNCTION(easter_days) { http://cvs.php.net/viewvc.cgi/php-src/ext/calendar/cal_unix.c?r1=1.24&r2=1.25&diff_format=u Index: php-src/ext/calendar/cal_unix.c diff -u php-src/ext/calendar/cal_unix.c:1.24 php-src/ext/calendar/cal_unix.c:1.25 --- php-src/ext/calendar/cal_unix.c:1.24Mon Dec 31 07:12:07 2007 +++ php-src/ext/calendar/cal_unix.c Mon Jan 21 06:36:02 2008 @@ -24,7 +24,7 @@ #include "sdncal.h" #include -/* {{{ proto int unixtojd([int timestamp]) +/* {{{ proto int unixtojd([int timestamp]) U Convert UNIX timestamp to Julian Day */ PHP_FUNCTION(unixtojd) { @@ -56,7 +56,7 @@ } /* }}} */ -/* {{{ proto int jdtounix(int jday) +/* {{{ proto int jdtounix(int jday) U Convert Julian Day to UNIX timestamp */ PHP_FUNCTION(jdtounix) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/calendar calendar.c php_calendar.h
pollita Mon Jan 21 06:08:04 2008 UTC Modified files: /php-src/ext/calendar calendar.c php_calendar.h Log: Make unicode ready http://cvs.php.net/viewvc.cgi/php-src/ext/calendar/calendar.c?r1=1.54&r2=1.55&diff_format=u Index: php-src/ext/calendar/calendar.c diff -u php-src/ext/calendar/calendar.c:1.54 php-src/ext/calendar/calendar.c:1.55 --- php-src/ext/calendar/calendar.c:1.54Mon Dec 31 07:12:07 2007 +++ php-src/ext/calendar/calendar.c Mon Jan 21 06:08:03 2008 @@ -18,7 +18,7 @@ | Wez Furlong <[EMAIL PROTECTED]>| +--+ */ -/* $Id: calendar.c,v 1.54 2007/12/31 07:12:07 sebastian Exp $ */ +/* $Id: calendar.c,v 1.55 2008/01/21 06:08:03 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -35,6 +35,8 @@ #include +ZEND_DECLARE_MODULE_GLOBALS(calendar); + /* {{{ arginfo */ static ZEND_BEGIN_ARG_INFO_EX(arginfo_unixtojd, 0, 0, 0) @@ -169,6 +171,20 @@ {NULL, NULL, NULL} }; +static PHP_GINIT_FUNCTION(calendar) +{ + if (zend_set_converter_encoding(&(calendar_globals->iso_8859_8_conv), "iso-8859-8") == FAILURE) { + php_error(E_CORE_WARNING, "Unable to instatiate iso-8859-8 converter for calendar extension, will be unable to produce hebrew dates in unicode mode"); + calendar_globals = NULL; + } +} + +static PHP_GSHUTDOWN_FUNCTION(calendar) +{ + if (calendar_globals->iso_8859_8_conv) { + ucnv_close(calendar_globals->iso_8859_8_conv); + } +} zend_module_entry calendar_module_entry = { STANDARD_MODULE_HEADER, @@ -180,7 +196,11 @@ NULL, PHP_MINFO(calendar), NO_VERSION_YET, - STANDARD_MODULE_PROPERTIES, + PHP_MODULE_GLOBALS(calendar), + PHP_GINIT(calendar), + PHP_GSHUTDOWN(calendar), + NULL, + STANDARD_MODULE_PROPERTIES_EX, }; #ifdef COMPILE_DL_CALENDAR @@ -275,7 +295,7 @@ php_info_print_table_end(); } -static void _php_cal_info(int cal, zval **ret) +static void _php_cal_info(int cal, zval **ret TSRMLS_DC) { zval *months, *smonths; int i; @@ -290,23 +310,23 @@ array_init(smonths); for (i = 1; i <= calendar->num_months; i++) { - add_index_string(months, i, calendar->month_name_long[i], 1); - add_index_string(smonths, i, calendar->month_name_short[i], 1); + add_index_ascii_string(months, i, calendar->month_name_long[i], ZSTR_DUPLICATE); + add_index_ascii_string(smonths, i, calendar->month_name_short[i], ZSTR_DUPLICATE); } - add_assoc_zval(*ret, "months", months); - add_assoc_zval(*ret, "abbrevmonths", smonths); - add_assoc_long(*ret, "maxdaysinmonth", calendar->max_days_in_month); - add_assoc_string(*ret, "calname", calendar->name, 1); - add_assoc_string(*ret, "calsymbol", calendar->symbol, 1); + + add_ascii_assoc_zval(*ret, "months", months); + add_ascii_assoc_zval(*ret, "abbrevmonths", smonths); + add_ascii_assoc_long(*ret, "maxdaysinmonth", calendar->max_days_in_month); + add_ascii_assoc_ascii_string(*ret, "calname", calendar->name, 1); + add_ascii_assoc_ascii_string(*ret, "calsymbol", calendar->symbol, 1); } -/* {{{ proto array cal_info([int calendar]) +/* {{{ proto array cal_info([int calendar]) U Returns information about a particular calendar */ PHP_FUNCTION(cal_info) { long cal = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &cal) == FAILURE) { RETURN_FALSE; @@ -320,7 +340,7 @@ for (i = 0; i < CAL_NUM_CALS; i++) { MAKE_STD_ZVAL(val); - _php_cal_info(i, &val); + _php_cal_info(i, &val TSRMLS_CC); add_index_zval(return_value, i, val); } return; @@ -332,12 +352,12 @@ RETURN_FALSE; } - _php_cal_info(cal, &return_value); + _php_cal_info(cal, &return_value TSRMLS_CC); } /* }}} */ -/* {{{ proto int cal_days_in_month(int calendar, int month, int year) +/* {{{ proto int cal_days_in_month(int calendar, int month, int year) U Returns the number of days in a month for a given year and calendar */ PHP_FUNCTION(cal_days_in_month) { @@ -366,7 +386,7 @@ sdn_next = calendar->to_jd(year, 1 + month, 1); if (sdn_next == 0) { -/* if invalid, try first month of the next year... */ + /* if invalid, try first month of the next year... */ sdn_next = calendar->to_jd(year + 1, 1, 1); } @@ -374,7 +394,7 @@ } /* }}} */ -/* {{{ proto int cal_to_jd(int calendar, int month, int day, int year) +/* {{{ proto int cal_to_jd(int calendar, int month, int day, int year) U Converts from a supported calendar to Julian Day
[PHP-CVS] cvs: php-src /ext/wddx php_wddx_api.h wddx.c
iliaa Sun Jan 20 15:33:42 2008 UTC Modified files: /php-src/ext/wddx php_wddx_api.h wddx.c Log: MFB: Optimize wddx boolean encoding http://cvs.php.net/viewvc.cgi/php-src/ext/wddx/php_wddx_api.h?r1=1.29&r2=1.30&diff_format=u Index: php-src/ext/wddx/php_wddx_api.h diff -u php-src/ext/wddx/php_wddx_api.h:1.29 php-src/ext/wddx/php_wddx_api.h:1.30 --- php-src/ext/wddx/php_wddx_api.h:1.29Mon Dec 31 07:12:17 2007 +++ php-src/ext/wddx/php_wddx_api.h Sun Jan 20 15:33:42 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_wddx_api.h,v 1.29 2007/12/31 07:12:17 sebastian Exp $ */ +/* $Id: php_wddx_api.h,v 1.30 2008/01/20 15:33:42 iliaa Exp $ */ #ifndef PHP_WDDX_API_H #define PHP_WDDX_API_H @@ -27,7 +27,8 @@ #define WDDX_ARRAY_E "" #define WDDX_BINARY_S "" #define WDDX_BINARY_E "" -#define WDDX_BOOLEAN "" +#define WDDX_BOOLEAN_TRUE "" +#define WDDX_BOOLEAN_FALSE "" #define WDDX_CHAR "" #define WDDX_COMMENT_S "" #define WDDX_COMMENT_E "" http://cvs.php.net/viewvc.cgi/php-src/ext/wddx/wddx.c?r1=1.149&r2=1.150&diff_format=u Index: php-src/ext/wddx/wddx.c diff -u php-src/ext/wddx/wddx.c:1.149 php-src/ext/wddx/wddx.c:1.150 --- php-src/ext/wddx/wddx.c:1.149 Mon Dec 31 07:12:17 2007 +++ php-src/ext/wddx/wddx.c Sun Jan 20 15:33:42 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: wddx.c,v 1.149 2007/12/31 07:12:17 sebastian Exp $ */ +/* $Id: wddx.c,v 1.150 2008/01/20 15:33:42 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -408,10 +408,7 @@ */ static void php_wddx_serialize_boolean(wddx_packet *packet, zval *var) { - char tmp_buf[WDDX_BUF_LEN]; - - snprintf(tmp_buf, sizeof(tmp_buf), WDDX_BOOLEAN, Z_LVAL_P(var) ? "true" : "false"); - php_wddx_add_chunk(packet, tmp_buf); + php_wddx_add_chunk(packet, Z_LVAL_P(var) ? WDDX_BOOLEAN_TRUE : WDDX_BOOLEAN_FALSE); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/wddx php_wddx_api.h wddx.c
iliaa Sun Jan 20 15:33:24 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/wddx php_wddx_api.h wddx.c Log: Optimize wddx boolean encoding http://cvs.php.net/viewvc.cgi/php-src/ext/wddx/php_wddx_api.h?r1=1.23.2.3.2.1.2.1&r2=1.23.2.3.2.1.2.2&diff_format=u Index: php-src/ext/wddx/php_wddx_api.h diff -u php-src/ext/wddx/php_wddx_api.h:1.23.2.3.2.1.2.1 php-src/ext/wddx/php_wddx_api.h:1.23.2.3.2.1.2.2 --- php-src/ext/wddx/php_wddx_api.h:1.23.2.3.2.1.2.1Mon Dec 31 07:17:16 2007 +++ php-src/ext/wddx/php_wddx_api.h Sun Jan 20 15:33:24 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_wddx_api.h,v 1.23.2.3.2.1.2.1 2007/12/31 07:17:16 sebastian Exp $ */ +/* $Id: php_wddx_api.h,v 1.23.2.3.2.1.2.2 2008/01/20 15:33:24 iliaa Exp $ */ #ifndef PHP_WDDX_API_H #define PHP_WDDX_API_H @@ -27,7 +27,8 @@ #define WDDX_ARRAY_E "" #define WDDX_BINARY_S "" #define WDDX_BINARY_E "" -#define WDDX_BOOLEAN "" +#define WDDX_BOOLEAN_TRUE "" +#define WDDX_BOOLEAN_FALSE "" #define WDDX_CHAR "" #define WDDX_COMMENT_S "" #define WDDX_COMMENT_E "" http://cvs.php.net/viewvc.cgi/php-src/ext/wddx/wddx.c?r1=1.119.2.10.2.17.2.3&r2=1.119.2.10.2.17.2.4&diff_format=u Index: php-src/ext/wddx/wddx.c diff -u php-src/ext/wddx/wddx.c:1.119.2.10.2.17.2.3 php-src/ext/wddx/wddx.c:1.119.2.10.2.17.2.4 --- php-src/ext/wddx/wddx.c:1.119.2.10.2.17.2.3 Mon Dec 31 07:17:16 2007 +++ php-src/ext/wddx/wddx.c Sun Jan 20 15:33:24 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: wddx.c,v 1.119.2.10.2.17.2.3 2007/12/31 07:17:16 sebastian Exp $ */ +/* $Id: wddx.c,v 1.119.2.10.2.17.2.4 2008/01/20 15:33:24 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -407,10 +407,7 @@ */ static void php_wddx_serialize_boolean(wddx_packet *packet, zval *var) { - char tmp_buf[WDDX_BUF_LEN]; - - snprintf(tmp_buf, sizeof(tmp_buf), WDDX_BOOLEAN, Z_LVAL_P(var) ? "true" : "false"); - php_wddx_add_chunk(packet, tmp_buf); + php_wddx_add_chunk(packet, Z_LVAL_P(var) ? WDDX_BOOLEAN_TRUE : WDDX_BOOLEAN_FALSE); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS
bjori Sun Jan 20 14:14:28 2008 UTC Modified files: (Branch: PHP_5_3) /php-srcNEWS Log: Add note about new getopt() features http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.78&r2=1.2027.2.547.2.965.2.79&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.78 php-src/NEWS:1.2027.2.547.2.965.2.79 --- php-src/NEWS:1.2027.2.547.2.965.2.78Thu Jan 17 23:02:50 2008 +++ php-src/NEWSSun Jan 20 14:14:28 2008 @@ -31,6 +31,7 @@ - Added long-option feature to getopt() and made getopt() available also on win32 systems by adding a common getopt implementation into core. (David Soria Parra, Jani) +- Added support for optional values, and = as separator, in getopt(). (Hannes) - Added support for namespaces. (Dmitry, Stas, Gregory) - Added support for Late Static Binding. (Dmitry, Etienne Kneuss) - Added support for __callstatic() magic method. (Sara) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/mysql php_mysql.c
bjori Sun Jan 20 14:13:12 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/mysql php_mysql.c /php-srcNEWS Log: MFH: Fixed bug #43875 (Two error messages returned for $new and $flag argument in mysql_connect()) http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/php_mysql.c?r1=1.213.2.6.2.19&r2=1.213.2.6.2.20&diff_format=u Index: php-src/ext/mysql/php_mysql.c diff -u php-src/ext/mysql/php_mysql.c:1.213.2.6.2.19 php-src/ext/mysql/php_mysql.c:1.213.2.6.2.20 --- php-src/ext/mysql/php_mysql.c:1.213.2.6.2.19Mon Dec 31 07:20:08 2007 +++ php-src/ext/mysql/php_mysql.c Sun Jan 20 14:13:11 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_mysql.c,v 1.213.2.6.2.19 2007/12/31 07:20:08 sebastian Exp $ */ +/* $Id: php_mysql.c,v 1.213.2.6.2.20 2008/01/20 14:13:11 bjori Exp $ */ /* TODO: * @@ -559,7 +559,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!ll", &host_and_port, &host_len, &user, &user_len, &passwd, &passwd_len, &new_link, &client_flags)==FAILURE) { - WRONG_PARAM_COUNT; + return; } if (!host_and_port) { http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1057&r2=1.2027.2.547.2.1058&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1057 php-src/NEWS:1.2027.2.547.2.1058 --- php-src/NEWS:1.2027.2.547.2.1057Fri Jan 18 07:10:21 2008 +++ php-src/NEWSSun Jan 20 14:13:11 2008 @@ -10,6 +10,8 @@ - Fixed faulty fix for bug #40189 (endless loop in zlib.inflate stream filter). (Greg) +- Fixed bug #43875 (Two error messages returned for $new and $flag argument + in mysql_connect()). (Hannes) - Fixed bug #43863 (str_word_count() breaks on cyrillic "ya" in locale cp1251). (phprus at gmail dot com, Tony) - Fixed bug #43793 (zlib filter is unable to auto-detect gzip/zlib file headers). -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mysql php_mysql.c
bjori Sun Jan 20 14:10:44 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mysql php_mysql.c Log: MFH: Fixed bug#43875 (Two error messages returned for $new and $flag argument in mysql_connect()) http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/php_mysql.c?r1=1.213.2.6.2.16.2.7&r2=1.213.2.6.2.16.2.8&diff_format=u Index: php-src/ext/mysql/php_mysql.c diff -u php-src/ext/mysql/php_mysql.c:1.213.2.6.2.16.2.7 php-src/ext/mysql/php_mysql.c:1.213.2.6.2.16.2.8 --- php-src/ext/mysql/php_mysql.c:1.213.2.6.2.16.2.7Mon Dec 31 07:17:10 2007 +++ php-src/ext/mysql/php_mysql.c Sun Jan 20 14:10:44 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_mysql.c,v 1.213.2.6.2.16.2.7 2007/12/31 07:17:10 sebastian Exp $ */ +/* $Id: php_mysql.c,v 1.213.2.6.2.16.2.8 2008/01/20 14:10:44 bjori Exp $ */ /* TODO: * @@ -646,7 +646,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!ll", &host_and_port, &host_len, &user, &user_len, &passwd, &passwd_len, &new_link, &client_flags)==FAILURE) { - WRONG_PARAM_COUNT; + return; } if (!host_and_port) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mysql php_mysql.c
bjori Sun Jan 20 14:10:16 2008 UTC Modified files: /php-src/ext/mysql php_mysql.c Log: Fixed bug#43875 (Two error messages returned for $new and $flag argument in mysql_connect()) http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/php_mysql.c?r1=1.248&r2=1.249&diff_format=u Index: php-src/ext/mysql/php_mysql.c diff -u php-src/ext/mysql/php_mysql.c:1.248 php-src/ext/mysql/php_mysql.c:1.249 --- php-src/ext/mysql/php_mysql.c:1.248 Mon Dec 31 07:12:11 2007 +++ php-src/ext/mysql/php_mysql.c Sun Jan 20 14:10:16 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_mysql.c,v 1.248 2007/12/31 07:12:11 sebastian Exp $ */ +/* $Id: php_mysql.c,v 1.249 2008/01/20 14:10:16 bjori Exp $ */ /* TODO: * @@ -646,7 +646,7 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s&s&s&ll", &host_and_port, &host_len, UG(utf8_conv), &user, &user_len, UG(utf8_conv), &passwd, &passwd_len, UG(utf8_conv), &new_link, &client_flags)==FAILURE) { - WRONG_PARAM_COUNT; + return; } /* mysql_pconnect does not support new_link parameter */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_dllist.c /ext/spl/tests dllist_006.phpt
colder Sun Jan 20 13:26:03 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_dllist.c /php-src/ext/spl/tests dllist_006.phpt Log: MFH: Fix mem errors http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.1.2.4&r2=1.1.2.5&diff_format=u Index: php-src/ext/spl/spl_dllist.c diff -u php-src/ext/spl/spl_dllist.c:1.1.2.4 php-src/ext/spl/spl_dllist.c:1.1.2.5 --- php-src/ext/spl/spl_dllist.c:1.1.2.4Tue Jan 15 15:46:20 2008 +++ php-src/ext/spl/spl_dllist.cSun Jan 20 13:26:03 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_dllist.c,v 1.1.2.4 2008/01/15 15:46:20 rrichards Exp $ */ +/* $Id: spl_dllist.c,v 1.1.2.5 2008/01/20 13:26:03 colder Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -39,18 +39,12 @@ PHPAPI zend_class_entry *spl_ce_SplQueue; PHPAPI zend_class_entry *spl_ce_SplStack; -#define SPL_LLIST_DELREF(elem, dtor) if(!--(elem)->rc) { \ - if(dtor) { \ - dtor(elem); \ - } \ +#define SPL_LLIST_DELREF(elem) if(!--(elem)->rc) { \ efree(elem); \ elem = NULL; \ } -#define SPL_LLIST_CHECK_DELREF(elem, dtor) if((elem) && !--(elem)->rc) { \ - if(dtor) { \ - dtor(elem); \ - } \ +#define SPL_LLIST_CHECK_DELREF(elem) if((elem) && !--(elem)->rc) { \ efree(elem); \ elem = NULL; \ } @@ -113,7 +107,11 @@ /* {{{ spl_ptr_llist */ static void spl_ptr_llist_zval_dtor(spl_ptr_llist_element *elem) { /* {{{ */ - zval_ptr_dtor((zval **)&elem->data); + if (elem->data) { + zval_ptr_dtor((zval **)&elem->data); + elem->data = NULL; + } + } /* }}} */ @@ -148,7 +146,10 @@ while (current) { next = current->next; - SPL_LLIST_DELREF(current, dtor); + if(current && dtor) { + dtor(current); + } + SPL_LLIST_DELREF(current); current = next; } @@ -225,7 +226,6 @@ { void *data; spl_ptr_llist_element*tail = llist->tail; - spl_ptr_llist_dtor_func dtor = NULL; if (tail == NULL) { return NULL; @@ -240,8 +240,9 @@ llist->tail = tail->prev; llist->count--; data = tail->data; + tail->data = NULL; - SPL_LLIST_DELREF(tail, dtor); + SPL_LLIST_DELREF(tail); return data; } @@ -275,7 +276,6 @@ { void*data; spl_ptr_llist_element *head = llist->head; - spl_ptr_llist_dtor_func dtor = NULL; if (head == NULL) { return NULL; @@ -290,8 +290,9 @@ llist->head = head->next; llist->count--; data = head->data; + head->data = NULL; - SPL_LLIST_DELREF(head, dtor); + SPL_LLIST_DELREF(head); return data; } @@ -664,8 +665,7 @@ return Z_LVAL_P(offset); } } - zend_throw_exception(spl_ce_OutOfRangeException, "Invalid offset", 0 TSRMLS_CC); - return 0; + return -1; } /* }}} */ @@ -704,7 +704,7 @@ index = spl_dllist_offset_convert(zindex TSRMLS_CC); if (index < 0 || index >= intern->llist->count) { - zend_throw_exception(spl_ce_OutOfRangeException, "Offset out of range", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0 TSRMLS_CC); return; } @@ -744,7 +744,7 @@ index = spl_dllist_offset_convert(zindex TSRMLS_CC); if (index < 0 || index >= intern->llist->count) { - zend_throw_exception(spl_ce_OutOfRangeException, "Offset out of range", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0 TSRMLS_CC); return; } @@ -804,7 +804,11 @@ } /* finally, delete the element */ llist->count--; - SPL_LLIST_DELREF(element, llist->dtor); + + if(llist->dtor) { + llist->dtor(element); + } + SPL_LLIST_DELREF(element); } else { zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid", 0 TSRMLS_CC); return; @@ -815,7 +819,7 @@ { spl_dllist_it *iterator = (spl_dllist_it *)iter; - SPL_LLIST_CHECK_DELREF(iterator->traverse_pointer, iterator->object->llist->dtor); + SPL_LLIST_CHECK_DELREF(iterator->traverse_pointer); zend_user_it_invalidate_current(iter TSRMLS_CC); zval_ptr_dtor((zval**)&iterator->intern.it.data); @@ -838,7 +842,7 @@ spl_dllist_it *iterator = (spl_dllist_it *)iter; spl_ptr_llist_element *element = ite
[PHP-CVS] cvs: php-src /ext/spl spl_dllist.c /ext/spl/tests dllist_006.phpt
colder Sun Jan 20 12:51:33 2008 UTC Modified files: /php-src/ext/splspl_dllist.c /php-src/ext/spl/tests dllist_006.phpt Log: Fix mem errors http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_dllist.c?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/spl/spl_dllist.c diff -u php-src/ext/spl/spl_dllist.c:1.3 php-src/ext/spl/spl_dllist.c:1.4 --- php-src/ext/spl/spl_dllist.c:1.3Tue Jan 15 15:45:44 2008 +++ php-src/ext/spl/spl_dllist.cSun Jan 20 12:51:33 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_dllist.c,v 1.3 2008/01/15 15:45:44 rrichards Exp $ */ +/* $Id: spl_dllist.c,v 1.4 2008/01/20 12:51:33 colder Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -39,18 +39,12 @@ PHPAPI zend_class_entry *spl_ce_SplQueue; PHPAPI zend_class_entry *spl_ce_SplStack; -#define SPL_LLIST_DELREF(elem, dtor) if(!--(elem)->rc) { \ - if(dtor) { \ - dtor(elem); \ - } \ +#define SPL_LLIST_DELREF(elem) if(!--(elem)->rc) { \ efree(elem); \ elem = NULL; \ } -#define SPL_LLIST_CHECK_DELREF(elem, dtor) if((elem) && !--(elem)->rc) { \ - if(dtor) { \ - dtor(elem); \ - } \ +#define SPL_LLIST_CHECK_DELREF(elem) if((elem) && !--(elem)->rc) { \ efree(elem); \ elem = NULL; \ } @@ -113,7 +107,11 @@ /* {{{ spl_ptr_llist */ static void spl_ptr_llist_zval_dtor(spl_ptr_llist_element *elem) { /* {{{ */ - zval_ptr_dtor((zval **)&elem->data); + if (elem->data) { + zval_ptr_dtor((zval **)&elem->data); + elem->data = NULL; + } + } /* }}} */ @@ -148,7 +146,10 @@ while (current) { next = current->next; - SPL_LLIST_DELREF(current, dtor); + if(current && dtor) { + dtor(current); + } + SPL_LLIST_DELREF(current); current = next; } @@ -225,7 +226,6 @@ { void *data; spl_ptr_llist_element*tail = llist->tail; - spl_ptr_llist_dtor_func dtor = NULL; if (tail == NULL) { return NULL; @@ -240,8 +240,9 @@ llist->tail = tail->prev; llist->count--; data = tail->data; + tail->data = NULL; - SPL_LLIST_DELREF(tail, dtor); + SPL_LLIST_DELREF(tail); return data; } @@ -275,7 +276,6 @@ { void*data; spl_ptr_llist_element *head = llist->head; - spl_ptr_llist_dtor_func dtor = NULL; if (head == NULL) { return NULL; @@ -290,8 +290,9 @@ llist->head = head->next; llist->count--; data = head->data; + head->data = NULL; - SPL_LLIST_DELREF(head, dtor); + SPL_LLIST_DELREF(head); return data; } @@ -667,8 +668,7 @@ return Z_LVAL_P(offset); } } - zend_throw_exception(spl_ce_OutOfRangeException, "Invalid offset", 0 TSRMLS_CC); - return 0; + return -1; } /* }}} */ @@ -707,7 +707,7 @@ index = spl_dllist_offset_convert(zindex TSRMLS_CC); if (index < 0 || index >= intern->llist->count) { - zend_throw_exception(spl_ce_OutOfRangeException, "Offset out of range", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0 TSRMLS_CC); return; } @@ -747,7 +747,7 @@ index = spl_dllist_offset_convert(zindex TSRMLS_CC); if (index < 0 || index >= intern->llist->count) { - zend_throw_exception(spl_ce_OutOfRangeException, "Offset out of range", 0 TSRMLS_CC); + zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0 TSRMLS_CC); return; } @@ -807,7 +807,11 @@ } /* finally, delete the element */ llist->count--; - SPL_LLIST_DELREF(element, llist->dtor); + + if(llist->dtor) { + llist->dtor(element); + } + SPL_LLIST_DELREF(element); } else { zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid", 0 TSRMLS_CC); return; @@ -818,7 +822,7 @@ { spl_dllist_it *iterator = (spl_dllist_it *)iter; - SPL_LLIST_CHECK_DELREF(iterator->traverse_pointer, iterator->object->llist->dtor); + SPL_LLIST_CHECK_DELREF(iterator->traverse_pointer); zend_user_it_invalidate_current(iter TSRMLS_CC); zval_ptr_dtor((zval**)&iterator->intern.it.data); @@ -841,7 +845,7 @@ spl_dllist_it *iterator = (spl_dllist_it *)iter; spl_ptr_llist_element *element = iterator->traverse_pointer; - if (element == NULL)