[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/rand.c branches/PHP_5_3/ext/standard/tests/general_functions/bug46587.phpt trunk/ext/standard/rand.c trunk/ext/standard/tests/general_functio
cataphract Thu, 25 Nov 2010 16:44:20 + Revision: http://svn.php.net/viewvc?view=revisionrevision=305754 Log: - Fixed bug #53403 (use of unitialized values). Fixes the fix for bug #46587. - Added test for bug #46587. Bugs: http://bugs.php.net/53403 (Assigned) mt_rand() without min/max uses invalid min/max values http://bugs.php.net/46587 (Closed) mt_/rand produce out of range numbers when min = 0 and max get_randmax Changed paths: U php/php-src/branches/PHP_5_3/ext/standard/rand.c A php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug46587.phpt U php/php-src/trunk/ext/standard/rand.c A php/php-src/trunk/ext/standard/tests/general_functions/bug46587.phpt Modified: php/php-src/branches/PHP_5_3/ext/standard/rand.c === --- php/php-src/branches/PHP_5_3/ext/standard/rand.c2010-11-25 16:36:13 UTC (rev 305753) +++ php/php-src/branches/PHP_5_3/ext/standard/rand.c2010-11-25 16:44:20 UTC (rev 305754) @@ -315,18 +315,19 @@ long number; int argc = ZEND_NUM_ARGS(); - if (argc != 0 zend_parse_parameters(argc TSRMLS_CC, ll, min, max) == FAILURE) - return; + if (argc != 0) { + if (zend_parse_parameters(argc TSRMLS_CC, ll, min, max) == FAILURE) { + return; + } else if (max min) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, max(%ld) is smaller than min(%ld), max, min); + RETURN_FALSE; + } + } if (!BG(mt_rand_is_seeded)) { php_mt_srand(GENERATE_SEED() TSRMLS_CC); } - if (max min) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, max(%ld) is smaller than min(%ld), max, min); - RETURN_FALSE; - } - /* * Melo: hmms.. randomMT() returns 32 random bits... * Yet, the previous php_rand only returns 31 at most. Added: php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug46587.phpt === --- php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug46587.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug46587.phpt 2010-11-25 16:44:20 UTC (rev 305754) @@ -0,0 +1,16 @@ +--TEST-- +Bug #46587 (mt_rand() does not check that max is greater than min). +--FILE-- +?php + +var_dump(mt_rand(3,8)); +var_dump(mt_rand(8,3)); + +echo Done.\n; +? +--EXPECTF-- +int(%d) + +Warning: mt_rand(): max(3) is smaller than min(8) in %s on line %d +bool(false) +Done. Modified: php/php-src/trunk/ext/standard/rand.c === --- php/php-src/trunk/ext/standard/rand.c 2010-11-25 16:36:13 UTC (rev 305753) +++ php/php-src/trunk/ext/standard/rand.c 2010-11-25 16:44:20 UTC (rev 305754) @@ -315,18 +315,19 @@ long number; int argc = ZEND_NUM_ARGS(); - if (argc != 0 zend_parse_parameters(argc TSRMLS_CC, ll, min, max) == FAILURE) - return; + if (argc != 0) { + if (zend_parse_parameters(argc TSRMLS_CC, ll, min, max) == FAILURE) { + return; + } else if (max min) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, max(%ld) is smaller than min(%ld), max, min); + RETURN_FALSE; + } + } if (!BG(mt_rand_is_seeded)) { php_mt_srand(GENERATE_SEED() TSRMLS_CC); } - if (max min) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, max(%ld) is smaller than min(%ld), max, min); - RETURN_FALSE; - } - /* * Melo: hmms.. randomMT() returns 32 random bits... * Yet, the previous php_rand only returns 31 at most. Added: php/php-src/trunk/ext/standard/tests/general_functions/bug46587.phpt === --- php/php-src/trunk/ext/standard/tests/general_functions/bug46587.phpt (rev 0) +++ php/php-src/trunk/ext/standard/tests/general_functions/bug46587.phpt 2010-11-25 16:44:20 UTC (rev 305754) @@ -0,0 +1,16 @@ +--TEST-- +Bug #46587 (mt_rand() does not check that max is greater than min). +--FILE-- +?php + +var_dump(mt_rand(3,8)); +var_dump(mt_rand(8,3)); + +echo Done.\n; +? +--EXPECTF-- +int(%d) + +Warning: mt_rand(): max(3) is smaller than min(8) in %s on line %d +bool(false) +Done. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/iconv/tests/bug53304.phpt branches/PHP_5_3/ext/standard/quot_print.c trunk/ext/iconv/tests/bug53304.phpt trunk/ext/standard/quot
iliaaThu, 25 Nov 2010 21:38:06 + Revision: http://svn.php.net/viewvc?view=revisionrevision=305759 Log: Fixed bug #53304 (quot_print_decode does not handle lower-case hex digits) Bug: http://bugs.php.net/53304 (Assigned) iconv_mime_docode() doesn't handle lowercase hex digits Changed paths: U php/php-src/branches/PHP_5_3/NEWS A php/php-src/branches/PHP_5_3/ext/iconv/tests/bug53304.phpt U php/php-src/branches/PHP_5_3/ext/standard/quot_print.c A php/php-src/trunk/ext/iconv/tests/bug53304.phpt U php/php-src/trunk/ext/standard/quot_print.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2010-11-25 20:50:30 UTC (rev 305758) +++ php/php-src/branches/PHP_5_3/NEWS 2010-11-25 21:38:06 UTC (rev 305759) @@ -7,6 +7,8 @@ - Core: . Fixed extract() to do not overwrite $GLOBALS and $this when using EXTR_OVERWRITE. (jorto at redhat dot com) + . Fixed bug #53304 (quot_print_decode does not handle lower-case hex digits). +(Ilia, daniel dot mueller at inexio dot net) . Fixed bug #47168 (printf of floating point variable prints maximum of 40 decimal places). (Ilia) . Fixed bug #46587 (mt_rand() does not check that max is greater than min). Added: php/php-src/branches/PHP_5_3/ext/iconv/tests/bug53304.phpt === --- php/php-src/branches/PHP_5_3/ext/iconv/tests/bug53304.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/iconv/tests/bug53304.phpt 2010-11-25 21:38:06 UTC (rev 305759) @@ -0,0 +1,13 @@ +--TEST-- +Bug #53304 (quot_print_decode does not handle lower-case hex digits) +--SKIPIF-- +?php extension_loaded('iconv') or die('skip iconv extension is not available'); ? +--FILE-- +?php +echo iconv_mime_decode('=?utf-8?Q?Nachricht_=c3=bcber_Kontaktformular_www.inexio.net?=', 0, 'UTF-8') . \n; +echo iconv_mime_decode('=?utf-8?Q?Nachricht_=C3=BCber_Kontaktformular_www.inexio.net?=', 0, 'UTF-8') . \n; + +? +--EXPECT-- +Nachricht über Kontaktformular www.inexio.net +Nachricht über Kontaktformular www.inexio.net Modified: php/php-src/branches/PHP_5_3/ext/standard/quot_print.c === --- php/php-src/branches/PHP_5_3/ext/standard/quot_print.c 2010-11-25 20:50:30 UTC (rev 305758) +++ php/php-src/branches/PHP_5_3/ext/standard/quot_print.c 2010-11-25 21:38:06 UTC (rev 305759) @@ -68,6 +68,7 @@ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 64, 64, 64, 64, 64, 64, 64, 10, 11, 12, 13, 14, 15, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 10, 11, 12, 13, 14, 15, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, @@ -76,7 +77,6 @@ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 }; Added: php/php-src/trunk/ext/iconv/tests/bug53304.phpt === --- php/php-src/trunk/ext/iconv/tests/bug53304.phpt (rev 0) +++ php/php-src/trunk/ext/iconv/tests/bug53304.phpt 2010-11-25 21:38:06 UTC (rev 305759) @@ -0,0 +1,13 @@ +--TEST-- +Bug #53304 (quot_print_decode does not handle lower-case hex digits) +--SKIPIF-- +?php extension_loaded('iconv') or die('skip iconv extension is not available'); ? +--FILE-- +?php +echo iconv_mime_decode('=?utf-8?Q?Nachricht_=c3=bcber_Kontaktformular_www.inexio.net?=', 0, 'UTF-8') . \n; +echo iconv_mime_decode('=?utf-8?Q?Nachricht_=C3=BCber_Kontaktformular_www.inexio.net?=', 0, 'UTF-8') . \n; + +? +--EXPECT-- +Nachricht über Kontaktformular www.inexio.net +Nachricht über Kontaktformular www.inexio.net Modified: php/php-src/trunk/ext/standard/quot_print.c === --- php/php-src/trunk/ext/standard/quot_print.c 2010-11-25 20:50:30 UTC (rev 305758) +++ php/php-src/trunk/ext/standard/quot_print.c 2010-11-25 21:38:06 UTC (rev 305759) @@ -68,6 +68,7 @@ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 64, 64, 64, 64, 64, 64, 64, 10, 11, 12, 13, 14, 15, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 10, 11,
[PHP-CVS] svn: /php/php-src/trunk/ Zend/zend_language_scanner.c Zend/zend_language_scanner_defs.h ext/com_dotnet/com_com.c ext/com_dotnet/com_dotnet.c ext/com_dotnet/com_misc.c ext/com_dotnet/com_olec
pajoye Thu, 25 Nov 2010 23:06:12 + Revision: http://svn.php.net/viewvc?view=revisionrevision=305761 Log: - cleanup broken double definition of php_win_err and rename it while being there Changed paths: U php/php-src/trunk/Zend/zend_language_scanner.c U php/php-src/trunk/Zend/zend_language_scanner_defs.h U php/php-src/trunk/ext/com_dotnet/com_com.c U php/php-src/trunk/ext/com_dotnet/com_dotnet.c U php/php-src/trunk/ext/com_dotnet/com_misc.c U php/php-src/trunk/ext/com_dotnet/com_olechar.c U php/php-src/trunk/ext/com_dotnet/com_variant.c U php/php-src/trunk/ext/com_dotnet/php_com_dotnet_internal.h U php/php-src/trunk/win32/winutil.c U php/php-src/trunk/win32/winutil.h Modified: php/php-src/trunk/Zend/zend_language_scanner.c === --- php/php-src/trunk/Zend/zend_language_scanner.c 2010-11-25 22:49:58 UTC (rev 305760) +++ php/php-src/trunk/Zend/zend_language_scanner.c 2010-11-25 23:06:12 UTC (rev 305761) @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Wed Nov 24 08:41:46 2010 */ +/* Generated by re2c 0.13.5 on Thu Nov 25 23:17:48 2010 */ #line 1 Zend/zend_language_scanner.l /* +--+ Modified: php/php-src/trunk/Zend/zend_language_scanner_defs.h === --- php/php-src/trunk/Zend/zend_language_scanner_defs.h 2010-11-25 22:49:58 UTC (rev 305760) +++ php/php-src/trunk/Zend/zend_language_scanner_defs.h 2010-11-25 23:06:12 UTC (rev 305761) @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Wed Nov 24 08:41:46 2010 */ +/* Generated by re2c 0.13.5 on Thu Nov 25 23:17:48 2010 */ #line 3 Zend/zend_language_scanner_defs.h enum YYCONDTYPE { Modified: php/php-src/trunk/ext/com_dotnet/com_com.c === --- php/php-src/trunk/ext/com_dotnet/com_com.c 2010-11-25 22:49:58 UTC (rev 305760) +++ php/php-src/trunk/ext/com_dotnet/com_com.c 2010-11-25 23:06:12 UTC (rev 305761) @@ -224,7 +224,7 @@ if (FAILED(res)) { char *werr, *msg; - werr = php_win_err(res); + werr = php_win32_error_to_msg(res); spprintf(msg, 0, Failed to create COM object `%s': %s, module_name, werr); LocalFree(werr); @@ -383,7 +383,7 @@ case DISP_E_PARAMNOTFOUND: case DISP_E_TYPEMISMATCH: - desc = php_win_err(hr); + desc = php_win32_error_to_msg(hr); spprintf(msg, 0, Parameter %d: %s, arg_err, desc); LocalFree(desc); break; @@ -399,7 +399,7 @@ /* else fall through */ default: - desc = php_win_err(hr); + desc = php_win32_error_to_msg(hr); spprintf(msg, 0, Error [0x%08x] %s, hr, desc); LocalFree(desc); break; @@ -481,7 +481,7 @@ if (FAILED(hr)) { char *winerr = NULL; char *msg = NULL; - winerr = php_win_err(hr); + winerr = php_win32_error_to_msg(hr); spprintf(msg, 0, Unable to lookup `%s': %s, name, winerr); LocalFree(winerr); php_com_throw_exception(hr, msg TSRMLS_CC); @@ -640,7 +640,7 @@ hr = php_com_get_id_of_name(obj, name, namelen, dispid TSRMLS_CC); if (FAILED(hr)) { - winerr = php_win_err(hr); + winerr = php_win32_error_to_msg(hr); spprintf(msg, 0, Unable to lookup `%s': %s, name, winerr); LocalFree(winerr); php_com_throw_exception(hr, msg TSRMLS_CC); Modified: php/php-src/trunk/ext/com_dotnet/com_dotnet.c === --- php/php-src/trunk/ext/com_dotnet/com_dotnet.c 2010-11-25 22:49:58 UTC (rev 305760) +++ php/php-src/trunk/ext/com_dotnet/com_dotnet.c 2010-11-25 23:06:12 UTC (rev 305761) @@ -199,7 +199,7 @@ hr = dotnet_init(where TSRMLS_CC); if (FAILED(hr)) { char buf[1024]; - char *err = php_win_err(hr); + char *err = php_win32_error_to_msg(hr); snprintf(buf, sizeof(buf), Failed to init .Net runtime [%s] %s, where, err); if (err) LocalFree(err); @@ -278,7 +278,7 @@ if (ret == FAILURE) { char buf[1024]; - char *err = php_win_err(hr); + char *err = php_win32_error_to_msg(hr);