[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
iliaa Tue Jan 20 18:03:33 2009 UTC Modified files: /php-src/ext/standard formatted_print.c Log: MFB: Added an E_NOTICE when precision value is truncated http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.108r2=1.109diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.108 php-src/ext/standard/formatted_print.c:1.109 --- php-src/ext/standard/formatted_print.c:1.108Wed Dec 31 11:12:36 2008 +++ php-src/ext/standard/formatted_print.c Tue Jan 20 18:03:33 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.108 2008/12/31 11:12:36 sebastian Exp $ */ +/* $Id: formatted_print.c,v 1.109 2009/01/20 18:03:33 iliaa Exp $ */ #include math.h /* modf() */ #include php.h @@ -358,6 +358,7 @@ if ((adjust ADJ_PRECISION) == 0) { precision = FLOAT_PRECISION; } else if (precision MAX_FLOAT_PRECISION) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, Requested precision of %d digits was truncated to PHP maximum of %d digits, precision, MAX_FLOAT_PRECISION); precision = MAX_FLOAT_PRECISION; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c /ext/standard/tests/strings printf.phpt sprintf_error.phpt vfprintf_error4.phpt vsprintf_error.phpt
felipe Sun Aug 10 21:48:22 2008 UTC Modified files: /php-src/ext/standard formatted_print.c /php-src/ext/standard/tests/strings printf.phpt sprintf_error.phpt vfprintf_error4.phpt vsprintf_error.phpt Log: - New parameter parsing API (for *printf()) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.106r2=1.107diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.106 php-src/ext/standard/formatted_print.c:1.107 --- php-src/ext/standard/formatted_print.c:1.106Tue Jul 1 10:01:25 2008 +++ php-src/ext/standard/formatted_print.c Sun Aug 10 21:48:22 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.106 2008/07/01 10:01:25 dmitry Exp $ */ +/* $Id: formatted_print.c,v 1.107 2008/08/10 21:48:22 felipe Exp $ */ #include math.h /* modf() */ #include php.h @@ -980,16 +980,13 @@ int always_sign; zstr result_str; - argc = ZEND_NUM_ARGS(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, +, args, argc) == FAILURE) { + return NULL_ZSTR; + } /* verify the number of args */ if ((use_array argc != (2 + format_offset)) || (!use_array argc (1 + format_offset))) { - WRONG_PARAM_COUNT_WITH_RETVAL(NULL_ZSTR); - } - args = (zval ***)safe_emalloc(argc, sizeof(zval *), 0); - - if (zend_get_parameters_array_ex(argc, args) == FAILURE) { efree(args); WRONG_PARAM_COUNT_WITH_RETVAL(NULL_ZSTR); } @@ -1364,19 +1361,19 @@ PHP_FUNCTION(fprintf) { php_stream *stream; - zval **arg1, **arg2; + zval *arg1, **arg2; zstr result; int len, ret; if (ZEND_NUM_ARGS() 2) { WRONG_PARAM_COUNT; } - - if (zend_get_parameters_ex(2, arg1, arg2)==FAILURE) { + + if (zend_parse_parameters(2 TSRMLS_CC, rZ, arg1, arg2) == FAILURE) { RETURN_FALSE; } - php_stream_from_zval(stream, arg1); + php_stream_from_zval(stream, arg1); if (Z_TYPE_PP(arg2) != IS_STRING Z_TYPE_PP(arg2) != IS_UNICODE) { convert_to_text_ex(arg2); @@ -1406,7 +1403,7 @@ PHP_FUNCTION(vfprintf) { php_stream *stream; - zval **arg1, **arg2; + zval *arg1, **arg2; zstr result; int len, ret; @@ -1414,11 +1411,11 @@ WRONG_PARAM_COUNT; } - if (zend_get_parameters_ex(2, arg1, arg2)==FAILURE) { + if (zend_parse_parameters(2 TSRMLS_CC, rZ, arg1, arg2) == FAILURE) { RETURN_FALSE; } - php_stream_from_zval(stream, arg1); + php_stream_from_zval(stream, arg1); if (Z_TYPE_PP(arg2) != IS_STRING Z_TYPE_PP(arg2) != IS_UNICODE) { convert_to_text_ex(arg2); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/printf.phpt?r1=1.5r2=1.6diff_format=u Index: php-src/ext/standard/tests/strings/printf.phpt diff -u php-src/ext/standard/tests/strings/printf.phpt:1.5 php-src/ext/standard/tests/strings/printf.phpt:1.6 --- php-src/ext/standard/tests/strings/printf.phpt:1.5 Thu Apr 26 23:42:36 2007 +++ php-src/ext/standard/tests/strings/printf.phpt Sun Aug 10 21:48:22 2008 @@ -227,7 +227,7 @@ --EXPECTF-- *** Output for zero argument *** -Warning: Wrong parameter count for printf() in %s on line %d +Warning: printf() expects at least %d parameter, %d given in %s on line %d *** Output for insufficient number of arguments *** http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_error.phpt?r1=1.3r2=1.4diff_format=u Index: php-src/ext/standard/tests/strings/sprintf_error.phpt diff -u php-src/ext/standard/tests/strings/sprintf_error.phpt:1.3 php-src/ext/standard/tests/strings/sprintf_error.phpt:1.4 --- php-src/ext/standard/tests/strings/sprintf_error.phpt:1.3 Tue May 27 10:50:46 2008 +++ php-src/ext/standard/tests/strings/sprintf_error.phpt Sun Aug 10 21:48:22 2008 @@ -39,7 +39,7 @@ -- Testing sprintf() function with Zero arguments -- -Warning: Wrong parameter count for sprintf() in %s on line %d +Warning: sprintf() expects at least %d parameter, %d given in %s on line %d bool(false) -- Testing sprintf() function with less than expected no. of arguments -- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vfprintf_error4.phpt?r1=1.2r2=1.3diff_format=u Index: php-src/ext/standard/tests/strings/vfprintf_error4.phpt diff -u php-src/ext/standard/tests/strings/vfprintf_error4.phpt:1.2 php-src/ext/standard/tests/strings/vfprintf_error4.phpt:1.3 --- php-src/ext/standard/tests/strings/vfprintf_error4.phpt:1.2 Sun Jun 22
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
dmitry Tue Jul 1 10:01:25 2008 UTC Modified files: /php-src/ext/standard formatted_print.c Log: Use new parameter parsing API http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.105r2=1.106diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.105 php-src/ext/standard/formatted_print.c:1.106 --- php-src/ext/standard/formatted_print.c:1.105Mon Mar 17 23:07:55 2008 +++ php-src/ext/standard/formatted_print.c Tue Jul 1 10:01:25 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.105 2008/03/17 23:07:55 stas Exp $ */ +/* $Id: formatted_print.c,v 1.106 2008/07/01 10:01:25 dmitry Exp $ */ #include math.h /* modf() */ #include php.h @@ -669,16 +669,13 @@ char *format, *result, padding; int always_sign; - argc = ZEND_NUM_ARGS(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, +, args, argc) == FAILURE) { + return NULL; + } /* verify the number of args */ if ((use_array argc != (2 + format_offset)) || (!use_array argc (1 + format_offset))) { - WRONG_PARAM_COUNT_WITH_RETVAL(NULL); - } - args = (zval ***)safe_emalloc(argc, sizeof(zval *), 0); - - if (zend_get_parameters_array_ex(argc, args) == FAILURE) { efree(args); WRONG_PARAM_COUNT_WITH_RETVAL(NULL); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c ftp_fopen_wrapper.c http_fopen_wrapper.c
janiSun Sep 30 05:43:28 2007 UTC Modified files: /php-src/ext/standard formatted_print.c ftp_fopen_wrapper.c http_fopen_wrapper.c Log: - Nuked ending dots in error messages http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.102r2=1.103diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.102 php-src/ext/standard/formatted_print.c:1.103 --- php-src/ext/standard/formatted_print.c:1.102Fri Jul 13 15:52:38 2007 +++ php-src/ext/standard/formatted_print.c Sun Sep 30 05:43:28 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.102 2007/07/13 15:52:38 tony2001 Exp $ */ +/* $Id: formatted_print.c,v 1.103 2007/09/30 05:43:28 jani Exp $ */ #include math.h /* modf() */ #include php.h @@ -735,7 +735,7 @@ if (argnum = 0) { efree(result); efree(args); - php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument number must be greater than zero.); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument number must be greater than zero); return NULL; } @@ -777,7 +777,7 @@ if ((width = php_sprintf_getnumber(format, inpos)) 0) { efree(result); efree(args); - php_error_docref(NULL TSRMLS_CC, E_WARNING, Width must be greater than zero and less than %d., INT_MAX); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Width must be greater than zero and less than %d, INT_MAX); return NULL; } adjusting |= ADJ_WIDTH; @@ -794,7 +794,7 @@ if ((precision = php_sprintf_getnumber(format, inpos)) 0) { efree(result); efree(args); - php_error_docref(NULL TSRMLS_CC, E_WARNING, Precision must be greater than zero and less than %d., INT_MAX); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Precision must be greater than zero and less than %d, INT_MAX); return NULL; } adjusting |= ADJ_PRECISION; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/ftp_fopen_wrapper.c?r1=1.98r2=1.99diff_format=u Index: php-src/ext/standard/ftp_fopen_wrapper.c diff -u php-src/ext/standard/ftp_fopen_wrapper.c:1.98 php-src/ext/standard/ftp_fopen_wrapper.c:1.99 --- php-src/ext/standard/ftp_fopen_wrapper.c:1.98 Thu Sep 27 13:16:09 2007 +++ php-src/ext/standard/ftp_fopen_wrapper.cSun Sep 30 05:43:28 2007 @@ -18,7 +18,7 @@ | Sara Golemon [EMAIL PROTECTED] | +--+ */ -/* $Id: ftp_fopen_wrapper.c,v 1.98 2007/09/27 13:16:09 jani Exp $ */ +/* $Id: ftp_fopen_wrapper.c,v 1.99 2007/09/30 05:43:28 jani Exp $ */ #include php.h #include php_globals.h @@ -412,7 +412,7 @@ } if (strpbrk(mode, wa+)) { if (read_write) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, FTP does not support simultaneous read/write connections.); + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, FTP does not support simultaneous read/write connections); return NULL; } if (strchr(mode, 'a')) { @@ -423,7 +423,7 @@ } if (!read_write) { /* No mode specified? */ - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, Unknown file open mode.); + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, Unknown file open mode); return NULL; } @@ -486,7 +486,7 @@ goto errexit; } } else { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, Remote file already exists and overwrite context option not specified.); +
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c /ext/standard/tests/array bug35014_64bit.phpt
tony2001Fri Jul 13 15:52:38 2007 UTC Modified files: /php-src/ext/standard formatted_print.c /php-src/ext/standard/tests/array bug35014_64bit.phpt Log: fix %u in Unicode mode http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.101r2=1.102diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.101 php-src/ext/standard/formatted_print.c:1.102 --- php-src/ext/standard/formatted_print.c:1.101Sun Jun 3 09:11:52 2007 +++ php-src/ext/standard/formatted_print.c Fri Jul 13 15:52:38 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.101 2007/06/03 09:11:52 shire Exp $ */ +/* $Id: formatted_print.c,v 1.102 2007/07/13 15:52:38 tony2001 Exp $ */ #include math.h /* modf() */ #include php.h @@ -308,7 +308,7 @@ register unsigned long magn, nmagn; register unsigned int i = NUM_BUF_SIZE - 1; - magn = (unsigned int) number; + magn = (unsigned long) number; /* Can't right-pad 0's on integers */ if (alignment == 0 padding == 0x30 /* '0' */) padding = 0x20 /* ' ' */; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug35014_64bit.phpt?r1=1.4r2=1.5diff_format=u Index: php-src/ext/standard/tests/array/bug35014_64bit.phpt diff -u php-src/ext/standard/tests/array/bug35014_64bit.phpt:1.4 php-src/ext/standard/tests/array/bug35014_64bit.phpt:1.5 --- php-src/ext/standard/tests/array/bug35014_64bit.phpt:1.4Mon Jun 4 01:23:22 2007 +++ php-src/ext/standard/tests/array/bug35014_64bit.phptFri Jul 13 15:52:38 2007 @@ -31,8 +31,8 @@ int(9) float(1) int(99980001) -float(2.8404260053903E+20) -int(8589934590) +float(1.219953680145E+30) +float(3.6893488147419E+19) --UEXPECTF-- Warning: array_product() expects parameter 1 to be array, Unicode string given in %s on line %d NULL -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
shire Sun Jun 3 09:11:52 2007 UTC Modified files: /php-src/ext/standard formatted_print.c Log: Change printf %u behavior so that it does not truncate numbers at 32-bits. (Reported by Aditya Agarwal.) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.100r2=1.101diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.100 php-src/ext/standard/formatted_print.c:1.101 --- php-src/ext/standard/formatted_print.c:1.100Thu May 17 17:29:09 2007 +++ php-src/ext/standard/formatted_print.c Sun Jun 3 09:11:52 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.100 2007/05/17 17:29:09 tony2001 Exp $ */ +/* $Id: formatted_print.c,v 1.101 2007/06/03 09:11:52 shire Exp $ */ #include math.h /* modf() */ #include php.h @@ -278,7 +278,7 @@ PRINTF_DEBUG((sprintf: appenduint(%x, %x, %x, %d, %d, '%c', %d)\n, *buffer, pos, size, number, width, padding, alignment)); - magn = (unsigned int) number; + magn = (unsigned long) number; /* Can't right-pad 0's on integers */ if (alignment == 0 padding == '0') padding = ' '; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/standard formatted_print.c
Brian, Can you please add a test case. Thanks, Ilia -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/standard formatted_print.c
Yep, I think tests/strings/printf_64bit.phpt should actually cover this one though (once I commit the changes to fix these tests I broke). Let me know if you need any more specific tests though, basically printf(%u, -1) is now 18446744073709551615 rather than 4294967295 on 64-bit. On Jun 3, 2007, at 8:06 AM, Ilia Alshanetsky wrote: Brian, Can you please add a test case. Thanks, Ilia -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Shire [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c /ext/sysvmsg sysvmsg.c
tony2001Wed Jan 17 08:25:25 2007 UTC Modified files: /php-src/ext/sysvmsgsysvmsg.c /php-src/ext/standard formatted_print.c Log: fix grammar http://cvs.php.net/viewvc.cgi/php-src/ext/sysvmsg/sysvmsg.c?r1=1.30r2=1.31diff_format=u Index: php-src/ext/sysvmsg/sysvmsg.c diff -u php-src/ext/sysvmsg/sysvmsg.c:1.30 php-src/ext/sysvmsg/sysvmsg.c:1.31 --- php-src/ext/sysvmsg/sysvmsg.c:1.30 Mon Jan 8 22:35:25 2007 +++ php-src/ext/sysvmsg/sysvmsg.c Wed Jan 17 08:25:25 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: sysvmsg.c,v 1.30 2007/01/08 22:35:25 nlopess Exp $ */ +/* $Id: sysvmsg.c,v 1.31 2007/01/17 08:25:25 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -136,7 +136,7 @@ { php_info_print_table_start(); php_info_print_table_row(2, sysvmsg support, enabled); - php_info_print_table_row(2, Revision, $Revision: 1.30 $); + php_info_print_table_row(2, Revision, $Revision: 1.31 $); php_info_print_table_end(); } /* }}} */ @@ -288,7 +288,7 @@ } if (maxsize = 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, maximum size of the message has to be greater then zero); + php_error_docref(NULL TSRMLS_CC, E_WARNING, maximum size of the message has to be greater than zero); return; } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.98r2=1.99diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.98 php-src/ext/standard/formatted_print.c:1.99 --- php-src/ext/standard/formatted_print.c:1.98 Sat Jan 13 16:32:29 2007 +++ php-src/ext/standard/formatted_print.c Wed Jan 17 08:25:25 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.98 2007/01/13 16:32:29 iliaa Exp $ */ +/* $Id: formatted_print.c,v 1.99 2007/01/17 08:25:25 tony2001 Exp $ */ #include math.h /* modf() */ #include php.h @@ -735,7 +735,7 @@ if (argnum = 0) { efree(result); efree(args); - php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument number must be greater then zero.); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument number must be greater than zero.); return NULL; } @@ -777,7 +777,7 @@ if ((width = php_sprintf_getnumber(format, inpos)) 0) { efree(result); efree(args); - php_error_docref(NULL TSRMLS_CC, E_WARNING, Width must be greater then zero and less then %d., INT_MAX); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Width must be greater than zero and less than %d., INT_MAX); return NULL; } adjusting |= ADJ_WIDTH; @@ -794,7 +794,7 @@ if ((precision = php_sprintf_getnumber(format, inpos)) 0) { efree(result); efree(args); - php_error_docref(NULL TSRMLS_CC, E_WARNING, Precision must be greater then zero and less then %d., INT_MAX); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Precision must be greater than zero and less than %d., INT_MAX); return NULL; } adjusting |= ADJ_PRECISION; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/standard formatted_print.c
Just a grammar nit-pick, but in those new error messages, then should be than. :-) Fixed, thanks. Also, just noticed the period at the end of the messages, which the vast majority of messages elsewhere don't have, so seems like they should be removed. (I sent a patch a few months ago to remove trailing periods in the few errors that had one, and Hannes just applied it to HEAD; although a few others were added back since then...) IMO, those periods make the full generated warning line look weird, which was also mentioned in Bug #39112. If you want/need patches to save time, let me know... Matt -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/standard formatted_print.c
Hi Ilia, - Original Message - From: Ilia Alshanetsky Sent: Saturday, January 13, 2007 iliaa Sat Jan 13 16:32:29 2007 UTC Modified files: /php-src/ext/standard formatted_print.c Log: MFB: Improve validation of argnum, width and precision. [...] - php_error_docref(NULL TSRMLS_CC, E_WARNING, Zero is not a valid argument number); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument number must be greater then zero.); return NULL; } + php_error_docref(NULL TSRMLS_CC, E_WARNING, Width must be greater then zero and less then %d., INT_MAX); + return NULL; + } + php_error_docref(NULL TSRMLS_CC, E_WARNING, Precision must be greater then zero and less then %d., INT_MAX); + return NULL; + } Just a grammar nit-pick, but in those new error messages, then should be than. :-) Also, just noticed the period at the end of the messages, which the vast majority of messages elsewhere don't have, so seems like they should be removed. (I sent a patch a few months ago to remove trailing periods in the few errors that had one, and Hannes just applied it to HEAD; although a few others were added back since then...) IMO, those periods make the full generated warning line look weird, which was also mentioned in Bug #39112. If you want/need patches to save time, let me know... Matt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
iliaa Sat Jan 13 16:32:29 2007 UTC Modified files: /php-src/ext/standard formatted_print.c Log: MFB: Improve validation of argnum, width and precision. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.97r2=1.98diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.97 php-src/ext/standard/formatted_print.c:1.98 --- php-src/ext/standard/formatted_print.c:1.97 Fri Jan 12 02:04:27 2007 +++ php-src/ext/standard/formatted_print.c Sat Jan 13 16:32:29 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.97 2007/01/12 02:04:27 iliaa Exp $ */ +/* $Id: formatted_print.c,v 1.98 2007/01/13 16:32:29 iliaa Exp $ */ #include math.h /* modf() */ #include php.h @@ -591,7 +591,7 @@ /* }}} */ /* php_sprintf_getnumber() {{{ */ -inline static long +inline static int php_sprintf_getnumber(char *buffer, int *pos) { char *endptr; @@ -603,7 +603,12 @@ } PRINTF_DEBUG((sprintf_getnumber: number was %d bytes long\n, i)); *pos += i; - return num; + + if (num = INT_MAX || num 0) { + return -1; + } else { + return (int) num; + } } /* }}} */ @@ -651,10 +656,9 @@ { zval ***args, **z_format; int argc, size = 240, inpos = 0, outpos = 0, temppos; - int alignment, currarg, adjusting; + int alignment, currarg, adjusting, argnum, width, precision; char *format, *result, padding; int always_sign; - long argnum, width, precision; argc = ZEND_NUM_ARGS(); @@ -728,10 +732,10 @@ if (format[temppos] == '$') { argnum = php_sprintf_getnumber(format, inpos); - if (argnum == 0) { + if (argnum = 0) { efree(result); efree(args); - php_error_docref(NULL TSRMLS_CC, E_WARNING, Zero is not a valid argument number); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument number must be greater then zero.); return NULL; } @@ -770,7 +774,12 @@ /* after modifiers comes width */ if (isdigit((int)format[inpos])) { PRINTF_DEBUG((sprintf: getting width\n)); - width = php_sprintf_getnumber(format, inpos); + if ((width = php_sprintf_getnumber(format, inpos)) 0) { + efree(result); + efree(args); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Width must be greater then zero and less then %d., INT_MAX); + return NULL; + } adjusting |= ADJ_WIDTH; } else { width = 0; @@ -782,7 +791,12 @@ inpos++; PRINTF_DEBUG((sprintf: getting precision\n)); if (isdigit((int)format[inpos])) { - precision = php_sprintf_getnumber(format, inpos); + if ((precision = php_sprintf_getnumber(format, inpos)) 0) { + efree(result); + efree(args); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Precision must be greater then zero and less then %d., INT_MAX); + return NULL; + } adjusting |= ADJ_PRECISION; expprec = 1; } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
iliaa Fri Jan 12 02:04:27 2007 UTC Modified files: /php-src/ext/standard formatted_print.c Log: MFB: Use long instead of int where long is expected. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.96r2=1.97diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.96 php-src/ext/standard/formatted_print.c:1.97 --- php-src/ext/standard/formatted_print.c:1.96 Mon Jan 1 09:29:31 2007 +++ php-src/ext/standard/formatted_print.c Fri Jan 12 02:04:27 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.96 2007/01/01 09:29:31 sebastian Exp $ */ +/* $Id: formatted_print.c,v 1.97 2007/01/12 02:04:27 iliaa Exp $ */ #include math.h /* modf() */ #include php.h @@ -651,9 +651,10 @@ { zval ***args, **z_format; int argc, size = 240, inpos = 0, outpos = 0, temppos; - int alignment, width, precision, currarg, adjusting, argnum; + int alignment, currarg, adjusting; char *format, *result, padding; int always_sign; + long argnum, width, precision; argc = ZEND_NUM_ARGS(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
tony2001Mon Dec 25 11:15:08 2006 UTC Modified files: /php-src/ext/standard formatted_print.c Log: fix #36392 in Unicode mode http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.94r2=1.95diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.94 php-src/ext/standard/formatted_print.c:1.95 --- php-src/ext/standard/formatted_print.c:1.94 Fri Dec 22 15:30:18 2006 +++ php-src/ext/standard/formatted_print.c Mon Dec 25 11:15:08 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.94 2006/12/22 15:30:18 iliaa Exp $ */ +/* $Id: formatted_print.c,v 1.95 2006/12/25 11:15:08 tony2001 Exp $ */ #include math.h /* modf() */ #include php.h @@ -482,9 +482,6 @@ switch (fmt) { case 0x65 /* 'e' */: - if (precision) { - precision--; - } case 0x45 /* 'E' */: case 0x46 /* 'F' */: case 0x66 /* 'f' */: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c /ext/standard/tests/strings bug36392.phpt
iliaa Fri Dec 22 15:30:18 2006 UTC Modified files: /php-src/ext/standard/tests/strings bug36392.phpt /php-src/ext/standard formatted_print.c Log: MFB: Fixed bug #36392 (wrong number of decimal digits with %e specifier in sprintf). http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug36392.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/standard/tests/strings/bug36392.phpt diff -u /dev/null php-src/ext/standard/tests/strings/bug36392.phpt:1.2 --- /dev/null Fri Dec 22 15:30:18 2006 +++ php-src/ext/standard/tests/strings/bug36392.phptFri Dec 22 15:30:17 2006 @@ -0,0 +1,16 @@ +--TEST-- +Bug #36392 (wrong number of decimal digits with %e specifier in sprintf) +--FILE-- +?php + echo sprintf(%e\n, 1.123456789); + echo sprintf(%.10e\n, 1.123456789); + echo sprintf(%.0e\n, 1.123456789); + echo sprintf(%.1e\n, 1.123456789); + echo sprintf(%5.1e\n, 1.123456789); +? +--EXPECT-- +1.123457e+0 +1.1234567890e+0 +1e+0 +1.1e+0 +1.1e+0 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.93r2=1.94diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.93 php-src/ext/standard/formatted_print.c:1.94 --- php-src/ext/standard/formatted_print.c:1.93 Wed Dec 20 18:33:27 2006 +++ php-src/ext/standard/formatted_print.c Fri Dec 22 15:30:18 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.93 2006/12/20 18:33:27 andrei Exp $ */ +/* $Id: formatted_print.c,v 1.94 2006/12/22 15:30:18 iliaa Exp $ */ #include math.h /* modf() */ #include php.h @@ -368,9 +368,6 @@ switch (fmt) { case 'e': - if (precision) { - precision--; - } case 'E': case 'f': case 'F': -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c /main snprintf.c spprintf.c
dmitry Tue Dec 19 13:13:48 2006 UTC Modified files: /php-src/main snprintf.c spprintf.c /php-src/ext/standard formatted_print.c Log: Support for systems without locale.h http://cvs.php.net/viewvc.cgi/php-src/main/snprintf.c?r1=1.45r2=1.46diff_format=u Index: php-src/main/snprintf.c diff -u php-src/main/snprintf.c:1.45 php-src/main/snprintf.c:1.46 --- php-src/main/snprintf.c:1.45Tue Dec 19 11:55:16 2006 +++ php-src/main/snprintf.c Tue Dec 19 13:13:48 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: snprintf.c,v 1.45 2006/12/19 11:55:16 dmitry Exp $ */ +/* $Id: snprintf.c,v 1.46 2006/12/19 13:13:48 dmitry Exp $ */ #include php.h @@ -38,6 +38,9 @@ #ifdef HAVE_LOCALE_H #include locale.h +#define LCONV_DECIMAL_POINT (*lconv-decimal_point) +#else +#define LCONV_DECIMAL_POINT '.' #endif /* @@ -584,7 +587,9 @@ char num_buf[NUM_BUF_SIZE]; char char_buf[2]; /* for printing %% and %unknown */ +#ifdef HAVE_LOCALE_H struct lconv *lconv = NULL; +#endif /* * Flag variables @@ -941,12 +946,14 @@ s = inf; s_len = 3; } else { +#ifdef HAVE_LOCALE_H if (!lconv) { lconv = localeconv(); } +#endif s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form, (adjust_precision == NO) ? FLOAT_DIGITS : precision, -(*fmt == 'f')?(*lconv-decimal_point):'.', +(*fmt == 'f')?LCONV_DECIMAL_POINT:'.', is_negative, num_buf[1], s_len); if (is_negative) prefix_char = '-'; @@ -993,10 +1000,12 @@ /* * * We use num_buf[ 1 ], so that we have room for the sign */ +#ifdef HAVE_LOCALE_H if (!lconv) { lconv = localeconv(); } - s = php_gcvt(fp_num, precision, *lconv-decimal_point, (*fmt == 'G')?'E':'e', num_buf[1]); +#endif + s = php_gcvt(fp_num, precision, LCONV_DECIMAL_POINT, (*fmt == 'G')?'E':'e', num_buf[1]); if (*s == '-') prefix_char = *s++; else if (print_sign) http://cvs.php.net/viewvc.cgi/php-src/main/spprintf.c?r1=1.39r2=1.40diff_format=u Index: php-src/main/spprintf.c diff -u php-src/main/spprintf.c:1.39 php-src/main/spprintf.c:1.40 --- php-src/main/spprintf.c:1.39Tue Dec 19 11:55:16 2006 +++ php-src/main/spprintf.c Tue Dec 19 13:13:48 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spprintf.c,v 1.39 2006/12/19 11:55:16 dmitry Exp $ */ +/* $Id: spprintf.c,v 1.40 2006/12/19 13:13:48 dmitry Exp $ */ /* This is the spprintf implementation. * It has emerged from apache snprintf. See original header: @@ -93,6 +93,9 @@ #ifdef HAVE_LOCALE_H #include locale.h +#define LCONV_DECIMAL_POINT (*lconv-decimal_point) +#else +#define LCONV_DECIMAL_POINT '.' #endif #include snprintf.h @@ -230,7 +233,9 @@ char char_buf[2]; /* for printing %% and %unknown */ zend_bool free_s; /* free string if allocated here */ +#ifdef HAVE_LOCALE_H struct lconv *lconv = NULL; +#endif /* * Flag variables @@ -644,12 +649,14 @@ s = inf; s_len = 3; } else { +#ifdef HAVE_LOCALE_H if (!lconv) { lconv = localeconv(); } +#endif s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form, (adjust_precision == NO) ? FLOAT_DIGITS : precision, -(*fmt == 'f')?(*lconv-decimal_point):'.', +(*fmt == 'f')?LCONV_DECIMAL_POINT:'.',
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
andrei Tue Dec 19 18:41:40 2006 UTC Modified files: /php-src/ext/standard formatted_print.c Log: Unicode support in *printf() functions. (Antony, Andrei) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.91r2=1.92diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.91 php-src/ext/standard/formatted_print.c:1.92 --- php-src/ext/standard/formatted_print.c:1.91 Tue Dec 19 13:13:48 2006 +++ php-src/ext/standard/formatted_print.c Tue Dec 19 18:41:40 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.91 2006/12/19 13:13:48 dmitry Exp $ */ +/* $Id: formatted_print.c,v 1.92 2006/12/19 18:41:40 andrei Exp $ */ #include math.h /* modf() */ #include php.h @@ -43,6 +43,9 @@ #define MAX_FLOAT_DIGITS 38 #define MAX_FLOAT_PRECISION 40 +#define PHP_OUTPUT 0 +#define PHP_RUNTIME 1 + #if 0 /* trick to control varargs functions through cpp */ # define PRINTF_DEBUG(arg) php_printf arg @@ -53,7 +56,10 @@ static char hexchars[] = 0123456789abcdef; static char HEXCHARS[] = 0123456789ABCDEF; +static UChar u_hexchars[] = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66}; +static UChar u_HEXCHARS[] = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46}; +/* php_sprintf_appendchar() {{{ */ inline static void php_sprintf_appendchar(char **buffer, int *pos, int *size, char add TSRMLS_DC) { @@ -65,8 +71,21 @@ PRINTF_DEBUG((sprintf: appending '%c', pos=\n, add, *pos)); (*buffer)[(*pos)++] = add; } +/* }}} */ +/* php_u_sprintf_appendchar() {{{ */ +inline static void +php_u_sprintf_appendchar(UChar **buffer, int *pos, int *size, UChar add TSRMLS_DC) +{ + if ((*pos + 1) = *size) { + *size = 1; + *buffer = eurealloc(*buffer, *size); + } + (*buffer)[(*pos)++] = add; +} +/* }}} */ +/* php_sprintf_appendstring() {{{ */ inline static void php_sprintf_appendstring(char **buffer, int *pos, int *size, char *add, int min_width, int max_width, char padding, @@ -115,10 +134,57 @@ } } } +/* }}} */ + +/* php_u_sprintf_appendstring() {{{ */ +inline static void +php_u_sprintf_appendstring(UChar **buffer, int *pos, int *size, UChar *add, + int min_width, int max_width, UChar padding, + int alignment, int len, int neg, int expprec, int always_sign) +{ + register int npad; + int req_size; + int copy_len; + + copy_len = (expprec ? MIN(max_width, len) : len); + npad = min_width - copy_len; + if (npad 0) { + npad = 0; + } + + req_size = *pos + MAX(min_width, copy_len) + 1; + + if (req_size *size) { + while (req_size *size) { + *size = 1; + } + *buffer = eurealloc(*buffer, *size); + } + if (alignment == ALIGN_RIGHT) { + if ((neg || always_sign) padding == 0x30 /* '0' */) { + (*buffer)[(*pos)++] = (neg) ? 0x2D /* '-' */ : 0x2B /* '+' */; + add++; + len--; + copy_len--; + } + while (npad-- 0) { + (*buffer)[(*pos)++] = padding; + } + } + u_memcpy((*buffer)[*pos], add, copy_len + 1); + *pos += copy_len; + if (alignment == ALIGN_LEFT) { + while (npad--) { + (*buffer)[(*pos)++] = padding; + } + } +} +/* }}} */ +/* php_sprintf_appendint() {{{ */ inline static void -php_sprintf_appendint(char **buffer, int *pos, int *size, long number, +php_sprintf_appendint(char **buffer, int *pos, int *size, long number, int width, char padding, int alignment, int always_sign) { @@ -158,7 +224,49 @@ padding, alignment, (NUM_BUF_SIZE - 1) - i, neg, 0, always_sign); } +/* }}} */ +/* php_u_sprintf_appendint() {{{ */ +inline static void +php_u_sprintf_appendint(UChar **buffer, int *pos, int *size, long number, + int width, UChar padding, int alignment, + int always_sign) +{ + UChar numbuf[NUM_BUF_SIZE]; + register unsigned long magn, nmagn; + register unsigned int i = NUM_BUF_SIZE - 1, neg = 0; + + if (number 0) { + neg = 1; +
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c ZendEngine2 zend_strtod.c
tony2001Thu Dec 7 20:45:21 2006 UTC Modified files: /ZendEngine2zend_strtod.c /php-src/ext/standard formatted_print.c Log: initialize variables and make Coverity happy http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_strtod.c?r1=1.26r2=1.27diff_format=u Index: ZendEngine2/zend_strtod.c diff -u ZendEngine2/zend_strtod.c:1.26 ZendEngine2/zend_strtod.c:1.27 --- ZendEngine2/zend_strtod.c:1.26 Wed Dec 6 12:25:29 2006 +++ ZendEngine2/zend_strtod.c Thu Dec 7 20:45:21 2006 @@ -1452,9 +1452,9 @@ to hold the suppressed trailing zeros. */ - int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1, + int bbits, b2, b5, be, dig, i, ieps, ilim = 0, ilim0, ilim1, j, j1, k, k0, k_check, leftright, m2, m5, s2, s5, - spec_case, try_quick; + spec_case = 0, try_quick; Long L; #ifndef Sudden_Underflow int denorm; @@ -1831,9 +1831,9 @@ b2 += Log2P; s2 += Log2P; spec_case = 1; - } - else + } else { spec_case = 0; + } } /* Arrange for convenient computation of quotients: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.87r2=1.88diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.87 php-src/ext/standard/formatted_print.c:1.88 --- php-src/ext/standard/formatted_print.c:1.87 Wed Dec 6 16:28:27 2006 +++ php-src/ext/standard/formatted_print.c Thu Dec 7 20:45:21 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.87 2006/12/06 16:28:27 tony2001 Exp $ */ +/* $Id: formatted_print.c,v 1.88 2006/12/07 20:45:21 tony2001 Exp $ */ #include math.h /* modf() */ #include php.h @@ -196,9 +196,8 @@ TSRMLS_DC) { char num_buf[NUM_BUF_SIZE]; - char *s, *q; - int s_len; - int is_negative; + char *s = NULL, *q; + int s_len = 0, is_negative = 0; PRINTF_DEBUG((sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n, *buffer, pos, size, number, width, padding, alignment, fmt)); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
tony2001Wed Dec 6 14:47:19 2006 UTC Modified files: /php-src/ext/standard formatted_print.c Log: add missing 'F' modified (noticed by Matt) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.85r2=1.86diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.85 php-src/ext/standard/formatted_print.c:1.86 --- php-src/ext/standard/formatted_print.c:1.85 Wed Dec 6 09:50:28 2006 +++ php-src/ext/standard/formatted_print.c Wed Dec 6 14:47:19 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.85 2006/12/06 09:50:28 tony2001 Exp $ */ +/* $Id: formatted_print.c,v 1.86 2006/12/06 14:47:19 tony2001 Exp $ */ #include math.h /* modf() */ #include php.h @@ -227,6 +227,9 @@ if (precision) { precision--; } + case 'F': + fmt = 'f'; + /* break is missing */ case 'E': case 'f': s = ap_php_conv_fp(fmt, number, 0, precision, -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/standard formatted_print.c /ext/standard/tests/serialize 003.phpt /ext/standard/tests/strings sprintf_f.phpt /main snprintf.c snprintf.h spprintf.c ZendEngine2 zend
Hi Antony, The changes to formatted_print.c caught my eye because I was going to inquire about/resubmit a patch from August to add new features the the *printf() functions... :-) I see you've added g/G (and E). In appenddouble, however, I noticed that the F specifier is missing. Nothing to me personally, just wondering about BC for users. I haven't tried anything yet, so maybe locale decimal point/not is handled differently now. Regardless, F will be ignored, though it's still present in php_formatted_print(). If you want to see the patch I made in the summer, see http://news.php.net/php.internals/25276 and http://realplain.com/php/printf_additions.diff I never got around to creating tests for the new features, and also thought I should [maybe] make some small changes in how I did the code. Of course now I'll need to reimplement the appenddouble changes anyway, to accommodate the new code. I guess I'll go ahead and redo it soon. Any comments about the additions/patch from you or anyone else? Marcus said they sounded good before I made the patch, but I didn't hear any more. :-/ Thanks, Matt - Original Message - From: Antony Dovgal Sent: Wednesday, December 06, 2006 tony2001 Wed Dec 6 09:50:28 2006 UTC Modified files: /ZendEngine2 zend.c zend_strtod.c zend_strtod.h /php-src/ext/standard formatted_print.c /php-src/ext/standard/tests/serialize 003.phpt /php-src/ext/standard/tests/strings sprintf_f.phpt /php-src/main snprintf.c snprintf.h spprintf.c Log: use BSD licensed implementation of double-to-string utilities instead of LGPL one this patch also fixes thread safety issues in zend_strtod() -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] Re: [PHP-DEV] Re: [PHP-CVS] cvs: php-src /ext/standard formatted_print.c /ext/standard/tests/serialize 003.phpt /ext/standard/tests/strings sprintf_f.phpt /main snprintf.c snprintf.h sppr
On 12/06/2006 05:18 PM, Matt Wilmas wrote: Hi Antony, The changes to formatted_print.c caught my eye because I was going to inquire about/resubmit a patch from August to add new features the the *printf() functions... :-) I see you've added g/G (and E). In appenddouble, however, I noticed that the F specifier is missing. Nothing to me personally, just wondering about BC for users. I haven't tried anything yet, so maybe locale decimal point/not is handled differently now. Regardless, F will be ignored, though it's still present in php_formatted_print(). Fixed, thanks for the heads up. If you want to see the patch I made in the summer, see http://news.php.net/php.internals/25276 and http://realplain.com/php/printf_additions.diff I never got around to creating tests for the new features, and also thought I should [maybe] make some small changes in how I did the code. Of course now I'll need to reimplement the appenddouble changes anyway, to accommodate the new code. I guess I'll go ahead and redo it soon. Any comments about the additions/patch from you or anyone else? Marcus said they sounded good before I made the patch, but I didn't hear any more. :-/ I don't see any problems with this patch atm, but I'll need to play with it for some time. -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
tony2001Wed Dec 6 16:28:27 2006 UTC Modified files: /php-src/ext/standard formatted_print.c Log: move handling of 'F' to the top http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.86r2=1.87diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.86 php-src/ext/standard/formatted_print.c:1.87 --- php-src/ext/standard/formatted_print.c:1.86 Wed Dec 6 14:47:19 2006 +++ php-src/ext/standard/formatted_print.c Wed Dec 6 16:28:27 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.86 2006/12/06 14:47:19 tony2001 Exp $ */ +/* $Id: formatted_print.c,v 1.87 2006/12/06 16:28:27 tony2001 Exp $ */ #include math.h /* modf() */ #include php.h @@ -222,14 +222,14 @@ return; } - switch (fmt) { + switch (fmt) { + case 'F': + fmt = 'f'; + /* break is missing */ case 'e': if (precision) { precision--; } - case 'F': - fmt = 'f'; - /* break is missing */ case 'E': case 'f': s = ap_php_conv_fp(fmt, number, 0, precision, -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
iliaa Tue Jan 25 19:01:26 2005 EDT Modified files: /php-src/ext/standard formatted_print.c Log: Fixed bug #29733 (printf() handles repeated placeholders wrong). # Original patch by bugs dot php dot net at bluetwanger dot de http://cvs.php.net/diff.php/php-src/ext/standard/formatted_print.c?r1=1.80r2=1.81ty=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.80 php-src/ext/standard/formatted_print.c:1.81 --- php-src/ext/standard/formatted_print.c:1.80 Mon Nov 15 08:42:21 2004 +++ php-src/ext/standard/formatted_print.c Tue Jan 25 19:01:26 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.80 2004/11/15 13:42:21 derick Exp $ */ +/* $Id: formatted_print.c,v 1.81 2005/01/26 00:01:26 iliaa Exp $ */ #include math.h /* modf() */ #include php.h @@ -545,12 +545,6 @@ php_sprintf_appendchar(result, outpos, size, '%' TSRMLS_CC); inpos += 2; } else { - if (currarg = argc format[inpos + 1] != '%') { - efree(result); - efree(args); - php_error_docref(NULL TSRMLS_CC, E_WARNING, Too few arguments); - return NULL; - } /* starting a new format specifier, reset variables */ alignment = ALIGN_RIGHT; adjusting = 0; @@ -581,13 +575,6 @@ } argnum += format_offset; - - if (argnum = argc) { - efree(result); - efree(args); - php_error_docref(NULL TSRMLS_CC, E_WARNING, Too few arguments); - return NULL; - } /* after argnum comes modifiers */ PRINTF_DEBUG((sprintf: looking for modifiers\n @@ -643,6 +630,13 @@ argnum = currarg++ + format_offset; } + if (argnum = argc) { + efree(result); + efree(args); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Too few arguments); + return NULL; + } + if (format[inpos] == 'l') { inpos++; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c /ext/standard/tests/strings bug22207.phpt bug28633.phpt
iliaa Sun Jul 18 13:27:49 2004 EDT Added files: /php-src/ext/standard/tests/strings bug28633.phpt Modified files: /php-src/ext/standard formatted_print.c /php-src/ext/standard/tests/strings bug22207.phpt Log: Fixed bug #28633 (sprintf incorrectly adding padding to floats). http://cvs.php.net/diff.php/php-src/ext/standard/formatted_print.c?r1=1.77r2=1.78ty=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.77 php-src/ext/standard/formatted_print.c:1.78 --- php-src/ext/standard/formatted_print.c:1.77 Wed May 19 12:46:29 2004 +++ php-src/ext/standard/formatted_print.c Sun Jul 18 13:27:49 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.77 2004/05/19 16:46:29 abies Exp $ */ +/* $Id: formatted_print.c,v 1.78 2004/07/18 17:27:49 iliaa Exp $ */ #include math.h /* modf() */ #include php.h @@ -398,9 +398,6 @@ numbuf[i] = '\0'; - if (precision 0) { - width += (precision + 1); - } php_sprintf_appendstring(buffer, pos, size, numbuf, width, 0, padding, alignment, i, sign, 0, always_sign); } http://cvs.php.net/diff.php/php-src/ext/standard/tests/strings/bug22207.phpt?r1=1.1r2=1.2ty=u Index: php-src/ext/standard/tests/strings/bug22207.phpt diff -u php-src/ext/standard/tests/strings/bug22207.phpt:1.1 php-src/ext/standard/tests/strings/bug22207.phpt:1.2 --- php-src/ext/standard/tests/strings/bug22207.phpt:1.1Thu Feb 13 12:25:31 2003 +++ php-src/ext/standard/tests/strings/bug22207.phptSun Jul 18 13:27:49 2004 @@ -7,5 +7,5 @@ ? --EXPECT-- 1.1000e+0 -string(17)1.1000e+0 +string(11) 1.1000e+0 http://cvs.php.net/co.php/php-src/ext/standard/tests/strings/bug28633.phpt?r=1.1p=1 Index: php-src/ext/standard/tests/strings/bug28633.phpt +++ php-src/ext/standard/tests/strings/bug28633.phpt --TEST-- Bug #28633 (sprintf incorrectly adding padding to floats) --FILE-- ?php echo sprintf(%05.2f, 0.02) . \n; echo sprintf(%05.2f, 2.02) . \n; ? --EXPECT-- 00.02 02.02 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
abies Wed May 19 12:46:29 2004 EDT Modified files: /php-src/ext/standard formatted_print.c Log: Fixed unregistered bug (memory leak in printf() friends) http://cvs.php.net/diff.php/php-src/ext/standard/formatted_print.c?r1=1.76r2=1.77ty=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.76 php-src/ext/standard/formatted_print.c:1.77 --- php-src/ext/standard/formatted_print.c:1.76 Sun May 16 10:01:45 2004 +++ php-src/ext/standard/formatted_print.c Wed May 19 12:46:29 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.76 2004/05/16 14:01:45 helly Exp $ */ +/* $Id: formatted_print.c,v 1.77 2004/05/19 16:46:29 abies Exp $ */ #include math.h /* modf() */ #include php.h @@ -646,6 +646,7 @@ if (multiuse) { MAKE_STD_ZVAL(tmp); *tmp = **(args[argnum]); + INIT_PZVAL(tmp); zval_copy_ctor(tmp); } else { SEPARATE_ZVAL(args[argnum]); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
helly Sun May 16 10:01:45 2004 EDT Modified files: /php-src/ext/standard formatted_print.c Log: - Fix printf with floats http://cvs.php.net/diff.php/php-src/ext/standard/formatted_print.c?r1=1.75r2=1.76ty=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.75 php-src/ext/standard/formatted_print.c:1.76 --- php-src/ext/standard/formatted_print.c:1.75 Tue May 11 15:51:46 2004 +++ php-src/ext/standard/formatted_print.c Sun May 16 10:01:45 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.75 2004/05/11 19:51:46 iliaa Exp $ */ +/* $Id: formatted_print.c,v 1.76 2004/05/16 14:01:45 helly Exp $ */ #include math.h /* modf() */ #include php.h @@ -65,6 +65,7 @@ static char *php_convert_to_decimal(double arg, int ndigits, int *decpt, int *sign, int eflag) { register int r2; + int mvl; double fi, fj; register char *p, *p1; /*THREADX*/ @@ -90,13 +91,21 @@ p1 = cvt_buf[NDIG]; while (fi != 0) { fj = modf(fi / 10, fi); + if (p1 = cvt_buf[0]) { + mvl = NDIG - ndigits; + memmove(cvt_buf[mvl], cvt_buf[0], NDIG-mvl-1); + p1 += mvl; + } *--p1 = (int) ((fj + .03) * 10) + '0'; r2++; } while (p1 cvt_buf[NDIG]) *p++ = *p1++; } else if (arg 0) { - while ((fj = arg * 10.0) 0.999) { + while ((fj = arg * 10) 1) { + if (!eflag (r2 * -1) ndigits) { + break; + } arg = fj; r2--; } @@ -109,10 +118,17 @@ cvt_buf[0] = '\0'; return (cvt_buf); } - while (p = p1 p cvt_buf[NDIG]) { - arg *= 10; - arg = modf(arg, fj); + if (p = p1 p cvt_buf[NDIG]) { + arg = modf(arg * 10, fj); + if ((int)fj==10) { + *p++ = '1'; + fj = 0; + *decpt = ++r2; + } + while (p = p1 p cvt_buf[NDIG]) { *p++ = (int) fj + '0'; + arg = modf(arg * 10, fj); + } } if (p1 = cvt_buf[NDIG]) { cvt_buf[NDIG - 1] = '\0'; @@ -286,7 +302,7 @@ char numbuf[NUM_BUF_SIZE]; char *cvt; register int i = 0, j = 0; - int sign, decpt; + int sign, decpt, cvt_len; char decimal_point = EG(float_separator)[0]; PRINTF_DEBUG((sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n, @@ -312,6 +328,7 @@ } cvt = php_convert_to_decimal(number, precision, decpt, sign, (fmt == 'e')); + cvt_len = strlen(cvt); if (sign) { numbuf[i++] = '-'; @@ -330,10 +347,15 @@ } } } else { - while (decpt-- 0) - numbuf[i++] = cvt[j++]; - if (precision 0) + while (decpt-- 0) { + numbuf[i++] = j cvt_len ? cvt[j++] : '0'; + } + if (precision 0) { numbuf[i++] = decimal_point; + while (precision-- 0) { + numbuf[i++] = j cvt_len ? cvt[j++] : '0'; + } + } } } else if (fmt == 'e' || fmt == 'E') { char *exp_p; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
iliaa Tue May 11 15:51:46 2004 EDT Modified files: /php-src/ext/standard formatted_print.c Log: Make vprintf() and printf() return the length of the string printed. Make fprintf() and vfprints() return the correct length of the string printed. http://cvs.php.net/diff.php/php-src/ext/standard/formatted_print.c?r1=1.74r2=1.75ty=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.74 php-src/ext/standard/formatted_print.c:1.75 --- php-src/ext/standard/formatted_print.c:1.74 Mon Feb 16 12:09:37 2004 +++ php-src/ext/standard/formatted_print.c Tue May 11 15:51:46 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.74 2004/02/16 17:09:37 iliaa Exp $ */ +/* $Id: formatted_print.c,v 1.75 2004/05/11 19:51:46 iliaa Exp $ */ #include math.h /* modf() */ #include php.h @@ -781,6 +781,7 @@ } PHPWRITE(result, len); efree(result); + RETURN_LONG(len); } /* }}} */ @@ -796,6 +797,7 @@ } PHPWRITE(result, len); efree(result); + RETURN_LONG(len); } /* }}} */ @@ -826,7 +828,7 @@ efree(result); - RETVAL_LONG(len - 1); + RETURN_LONG(len); } /* {{{ proto int vfprintf(resource stream, string format, array args) @@ -856,7 +858,7 @@ efree(result); - RETVAL_LONG(len - 1); + RETURN_LONG(len); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
iliaa Mon Feb 16 12:09:38 2004 EDT Modified files: /php-src/ext/standard formatted_print.c Log: Fixed bug #27278 (*printf() functions treat arguments as if passed by reference). http://cvs.php.net/diff.php/php-src/ext/standard/formatted_print.c?r1=1.73r2=1.74ty=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.73 php-src/ext/standard/formatted_print.c:1.74 --- php-src/ext/standard/formatted_print.c:1.73 Tue Jan 20 23:00:07 2004 +++ php-src/ext/standard/formatted_print.c Mon Feb 16 12:09:37 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.73 2004/01/21 04:00:07 sniper Exp $ */ +/* $Id: formatted_print.c,v 1.74 2004/02/16 17:09:37 iliaa Exp $ */ #include math.h /* modf() */ #include php.h @@ -626,6 +626,7 @@ *tmp = **(args[argnum]); zval_copy_ctor(tmp); } else { + SEPARATE_ZVAL(args[argnum]); tmp = *(args[argnum]); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
sniper Tue Jan 20 23:00:08 2004 EDT Modified files: /php-src/ext/standard formatted_print.c Log: - Fixed bug #26973 (*printf() + modifier broken) http://cvs.php.net/diff.php/php-src/ext/standard/formatted_print.c?r1=1.72r2=1.73ty=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.72 php-src/ext/standard/formatted_print.c:1.73 --- php-src/ext/standard/formatted_print.c:1.72 Tue Jan 13 18:11:29 2004 +++ php-src/ext/standard/formatted_print.c Tue Jan 20 23:00:07 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.72 2004/01/13 23:11:29 iliaa Exp $ */ +/* $Id: formatted_print.c,v 1.73 2004/01/21 04:00:07 sniper Exp $ */ #include math.h /* modf() */ #include php.h @@ -155,7 +155,7 @@ inline static void php_sprintf_appendstring(char **buffer, int *pos, int *size, char *add, int min_width, int max_width, char padding, - int alignment, int len, int sign, int expprec) + int alignment, int len, int neg, int expprec, int always_sign) { register int npad; int req_size; @@ -181,8 +181,8 @@ *buffer = erealloc(*buffer, *size); } if (alignment == ALIGN_RIGHT) { - if (sign padding=='0') { - (*buffer)[(*pos)++] = '-'; + if ((neg || always_sign) padding=='0') { + (*buffer)[(*pos)++] = (neg) ? '-' : '+'; add++; len--; copy_len--; @@ -241,13 +241,13 @@ number, numbuf[i], i)); php_sprintf_appendstring(buffer, pos, size, numbuf[i], width, 0, padding, alignment, (NUM_BUF_SIZE - 1) - i, -neg, 0); +neg, 0, always_sign); } inline static void php_sprintf_appenduint(char **buffer, int *pos, int *size, unsigned long number, - int width, char padding, int alignment, int always_sign) + int width, char padding, int alignment) { char numbuf[NUM_BUF_SIZE]; register unsigned long magn, nmagn; @@ -269,11 +269,9 @@ magn = nmagn; } while (magn 0 i 0); - if (always_sign) - numbuf[--i] = '+'; PRINTF_DEBUG((sprintf: appending %d as \%s\, i=%d\n, number, numbuf[i], i)); php_sprintf_appendstring(buffer, pos, size, numbuf[i], width, 0, -padding, alignment, (NUM_BUF_SIZE - 1) - i, 0, 0); +padding, alignment, (NUM_BUF_SIZE - 1) - i, 0, 0, 0); } inline static void @@ -302,14 +300,14 @@ if (zend_isnan(number)) { sign = (number0); php_sprintf_appendstring(buffer, pos, size, NaN, 3, 0, padding, -alignment, precision, sign, 0); +alignment, precision, sign, 0, always_sign); return; } if (zend_isinf(number)) { sign = (number0); php_sprintf_appendstring(buffer, pos, size, INF, 3, 0, padding, -alignment, precision, sign, 0); +alignment, precision, sign, 0, always_sign); return; } @@ -382,7 +380,7 @@ width += (precision + 1); } php_sprintf_appendstring(buffer, pos, size, numbuf, width, 0, padding, -alignment, i, sign, 0); +alignment, i, sign, 0, always_sign); } @@ -412,7 +410,7 @@ php_sprintf_appendstring(buffer, pos, size, numbuf[i], width, 0, padding, alignment, (NUM_BUF_SIZE - 1) - i, -0, expprec); +0, expprec, 0); } @@ -647,7 +645,7 @@ width, precision, padding, alignment, Z_STRLEN_P(var), -
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c /ext/standard/tests/strings bug26878.phpt
iliaa Tue Jan 13 18:11:32 2004 EDT Added files: /php-src/ext/standard/tests/strings bug26878.phpt Modified files: /php-src/ext/standard formatted_print.c Log: Fixed bug #26878 (problem with multiple references to the same variable with different types). Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.71 php-src/ext/standard/formatted_print.c:1.72 --- php-src/ext/standard/formatted_print.c:1.71 Thu Jan 8 03:17:31 2004 +++ php-src/ext/standard/formatted_print.c Tue Jan 13 18:11:29 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.71 2004/01/08 08:17:31 andi Exp $ */ +/* $Id: formatted_print.c,v 1.72 2004/01/13 23:11:29 iliaa Exp $ */ #include math.h /* modf() */ #include php.h @@ -509,7 +509,8 @@ currarg = 1; while (inposZ_STRLEN_PP(args[format_offset])) { - int expprec = 0; + int expprec = 0, multiuse = 0; + zval *tmp; PRINTF_DEBUG((sprintf: format[%d]='%c'\n, inpos, format[inpos])); PRINTF_DEBUG((sprintf: outpos=%d\n, outpos)); @@ -547,7 +548,8 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, Zero is not a valid argument number); return NULL; } - + + multiuse = 1; inpos++; /* skip the '$' */ } else { argnum = currarg++; @@ -621,16 +623,24 @@ } PRINTF_DEBUG((sprintf: format character='%c'\n, format[inpos])); /* now we expect to find a type specifier */ + if (multiuse) { + MAKE_STD_ZVAL(tmp); + *tmp = **(args[argnum]); + zval_copy_ctor(tmp); + } else { + tmp = *(args[argnum]); + } + switch (format[inpos]) { case 's': { zval *var, var_copy; int use_copy; - - zend_make_printable_zval(*args[argnum], var_copy, use_copy); + + zend_make_printable_zval(tmp, var_copy, use_copy); if (use_copy) { var = var_copy; } else { - var = *args[argnum]; + var = tmp; } php_sprintf_appendstring(result, outpos, size, Z_STRVAL_P(var), @@ -645,17 +655,17 @@ } case 'd': - convert_to_long_ex(args[argnum]); + convert_to_long(tmp); php_sprintf_appendint(result, outpos, size, - Z_LVAL_PP(args[argnum]), + Z_LVAL_P(tmp), width, padding, alignment, always_sign); break; case 'u': - convert_to_long_ex(args[argnum]); + convert_to_long(tmp); php_sprintf_appenduint(result, outpos, size, - Z_LVAL_PP(args[argnum]), + Z_LVAL_P(tmp), width, padding, alignment, always_sign); break; @@ -663,9 +673,9 @@ case 'e': case 'f': /* XXX not done */ -
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c /tests/classes tostring.phpt
helly Mon Dec 29 17:26:49 2003 EDT Modified files: /php-src/ext/standard formatted_print.c /php-src/tests/classes tostring.phpt Log: Use __tostring() in all printing functions. Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.69 php-src/ext/standard/formatted_print.c:1.70 --- php-src/ext/standard/formatted_print.c:1.69 Mon Aug 11 19:16:53 2003 +++ php-src/ext/standard/formatted_print.c Mon Dec 29 17:26:47 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.69 2003/08/11 23:16:53 iliaa Exp $ */ +/* $Id: formatted_print.c,v 1.70 2003/12/29 22:26:47 helly Exp $ */ #include math.h /* modf() */ #include php.h @@ -622,15 +622,27 @@ PRINTF_DEBUG((sprintf: format character='%c'\n, format[inpos])); /* now we expect to find a type specifier */ switch (format[inpos]) { - case 's': - convert_to_string_ex(args[argnum]); + case 's': { + zval *var, var_copy; + int use_copy; + + zend_make_printable_zval(*args[argnum], var_copy, use_copy); + if (use_copy) { + var = var_copy; + } else { + var = *args[argnum]; + } php_sprintf_appendstring(result, outpos, size, - Z_STRVAL_PP(args[argnum]), + Z_STRVAL_P(var), width, precision, padding, alignment, - Z_STRLEN_PP(args[argnum]), + Z_STRLEN_P(var), 0, expprec); + if (use_copy) { + zval_dtor(var_copy); + } break; + } case 'd': convert_to_long_ex(args[argnum]); Index: php-src/tests/classes/tostring.phpt diff -u php-src/tests/classes/tostring.phpt:1.2 php-src/tests/classes/tostring.phpt:1.3 --- php-src/tests/classes/tostring.phpt:1.2 Mon Dec 15 11:59:20 2003 +++ php-src/tests/classes/tostring.phpt Mon Dec 29 17:26:48 2003 @@ -42,6 +42,13 @@ $ar = array(); $ar[$o-__toString()] = ERROR; echo $ar[$o]; + +echo test8\n; +var_dump(trim($o)); +var_dump(trim((string)$o)); + +echo test9\n; +echo sprintf(%s, $o); ? DONE! --EXPECTF-- @@ -51,7 +58,7 @@ ) Notice: Object of class test1 could not be converted to string in %stostring.php on line %d -string(6) Object +string(12) Object id #%d object(test1)#%d (0) { } test2 @@ -80,4 +87,13 @@ test2::__toString() Warning: Illegal offset type in %stostring.php on line %d +test8 + +Notice: Object of class test2 could not be converted to string in %stostring.php on line %d +string(6) Object +test2::__toString() +string(9) Converted +test9 +test2::__toString() +Converted DONE! -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php