[PHP-CVS] cvs: php-src(PHP_5_3) /ext/iconv/tests iconv_substr_basic.phpt iconv_substr_error1.phpt iconv_substr_error2.phpt
wharmby Sat Jun 13 12:17:42 2009 UTC Added files: (Branch: PHP_5_3) /php-src/ext/iconv/testsiconv_substr_basic.phpt iconv_substr_error2.phpt iconv_substr_error1.phpt Log: New iconv extension tests. Tested on Windows, Linux and Linux 64 bit. http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/tests/iconv_substr_basic.phpt?view=markuprev=1.1 Index: php-src/ext/iconv/tests/iconv_substr_basic.phpt +++ php-src/ext/iconv/tests/iconv_substr_basic.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/tests/iconv_substr_error2.phpt?view=markuprev=1.1 Index: php-src/ext/iconv/tests/iconv_substr_error2.phpt +++ php-src/ext/iconv/tests/iconv_substr_error2.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/tests/iconv_substr_error1.phpt?view=markuprev=1.1 Index: php-src/ext/iconv/tests/iconv_substr_error1.phpt +++ php-src/ext/iconv/tests/iconv_substr_error1.phpt -- 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) /ext/iconv/tests iconv_substr_basic.phpt iconv_substr_error1.phpt iconv_substr_error2.phpt
wharmby Sat Jun 13 12:17:43 2009 UTC Added files: (Branch: PHP_5_2) /php-src/ext/iconv/testsiconv_substr_basic.phpt iconv_substr_error1.phpt iconv_substr_error2.phpt Log: New iconv extension tests. Tested on Windows, Linux and Linux 64 bit. http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/tests/iconv_substr_basic.phpt?view=markuprev=1.1 Index: php-src/ext/iconv/tests/iconv_substr_basic.phpt +++ php-src/ext/iconv/tests/iconv_substr_basic.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/tests/iconv_substr_error1.phpt?view=markuprev=1.1 Index: php-src/ext/iconv/tests/iconv_substr_error1.phpt +++ php-src/ext/iconv/tests/iconv_substr_error1.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/tests/iconv_substr_error2.phpt?view=markuprev=1.1 Index: php-src/ext/iconv/tests/iconv_substr_error2.phpt +++ php-src/ext/iconv/tests/iconv_substr_error2.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/iconv/tests iconv_substr_basic.phpt iconv_substr_error1.phpt iconv_substr_error2.phpt
wharmby Sat Jun 13 12:17:45 2009 UTC Modified files: /php-src/ext/iconv/testsiconv_substr_error1.phpt iconv_substr_error2.phpt iconv_substr_basic.phpt Log: New iconv extension tests. Tested on Windows, Linux and Linux 64 bit. http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/tests/iconv_substr_error1.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/iconv/tests/iconv_substr_error1.phpt diff -u /dev/null php-src/ext/iconv/tests/iconv_substr_error1.phpt:1.2 --- /dev/null Sat Jun 13 12:17:45 2009 +++ php-src/ext/iconv/tests/iconv_substr_error1.phptSat Jun 13 12:17:45 2009 @@ -0,0 +1,49 @@ +--TEST-- +Test iconv_substr() function : error conditions - Pass incorrect number of args +--SKIPIF-- +?php +extension_loaded('iconv') or die('skip'); +function_exists('iconv_substr') or die(skip iconv_substr() is not available in this build); +? +--FILE-- +?php +/* Prototype : string iconv_substr(string str, int offset, [int length, string charset]) + * Description: Returns part of a string + * Source code: ext/iconv/iconv.c + */ + +/* + * Pass incorrect number of arguments to iconv_substr() to test behaviour + */ + +echo *** Testing iconv_substr() : error conditions ***\n; + +//Test iconv_substr with one more than the expected number of arguments +echo \n-- Testing iconv_substr() function with more than expected no. of arguments --\n; +$str = 'string_val'; +$start = 10; +$length = 10; +$encoding = 'string_val'; +$extra_arg = 10; +var_dump( iconv_substr($str, $start, $length, $encoding, $extra_arg) ); + +// Testing iconv_substr with one less than the expected number of arguments +echo \n-- Testing iconv_substr() function with less than expected no. of arguments --\n; +$str = 'string_val'; +var_dump( iconv_substr($str) ); + +? +===DONE=== +--EXPECTF-- +*** Testing iconv_substr() : error conditions *** + +-- Testing iconv_substr() function with more than expected no. of arguments -- + +Warning: iconv_substr() expects at most 4 parameters, 5 given in %s on line %d +bool(false) + +-- Testing iconv_substr() function with less than expected no. of arguments -- + +Warning: iconv_substr() expects at least 2 parameters, 1 given in %s on line %d +bool(false) +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/tests/iconv_substr_error2.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/iconv/tests/iconv_substr_error2.phpt diff -u /dev/null php-src/ext/iconv/tests/iconv_substr_error2.phpt:1.2 --- /dev/null Sat Jun 13 12:17:45 2009 +++ php-src/ext/iconv/tests/iconv_substr_error2.phptSat Jun 13 12:17:45 2009 @@ -0,0 +1,38 @@ +--TEST-- +Test iconv_substr() function : error conditions - Pass an unknown encoding +--SKIPIF-- +?php +extension_loaded('iconv') or die('skip'); +function_exists('iconv_substr') or die(skip iconv_substr() is not available in this build); +? +--XFAIL-- +Will fail until bug #48538 fixed +--FILE-- +?php +/* Prototype : string iconv_substr(string str, int offset, [int length, string charset]) + * Description: Returns part of a string + * Source code: ext/iconv/iconv.c + */ + +/* + * Pass an unknown encoding to iconv_substr() to test behaviour + */ + +echo *** Testing iconv_substr() : error conditions ***\n; + +$str = 'Hello, world'; +$start = 1; +$length = 5; +$encoding = 'unknown-encoding'; + +var_dump( iconv_substr($str, $start, $length, $encoding)); + +echo Done; +? +--EXPECTF-- +*** Testing iconv_substr() : error conditions *** + +Notice: iconv_substr(): Wrong charset, conversion from `unknown-encoding' to `UCS-4LE' is not allowed in %s on line %d +bool(false) +Done + http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/tests/iconv_substr_basic.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/iconv/tests/iconv_substr_basic.phpt diff -u /dev/null php-src/ext/iconv/tests/iconv_substr_basic.phpt:1.2 --- /dev/null Sat Jun 13 12:17:45 2009 +++ php-src/ext/iconv/tests/iconv_substr_basic.phpt Sat Jun 13 12:17:45 2009 @@ -0,0 +1,55 @@ +--TEST-- +Test iconv_substr() function : basic functionality +--SKIPIF-- +?php +extension_loaded('iconv') or die('skip'); +function_exists('iconv_substr') or die(skip iconv_substr() is not available in this build); +? +--FILE-- +?php +/* Prototype : string iconv_substr(string str, int offset, [int length, string charset]) + * Description: Returns part of a string + * Source code: ext/iconv/iconv.c + */ + +/* + * Test Basic Functionality of iconv_substr with ASCII characters and multibyte strings. + */ + +echo *** Testing iconv_substr() : basic functionality ***\n; + +$string_ascii = b'ABCDEF'; +//Japanese string in UTF-8 +$string_mb = base64_decode(b'5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII='); + +echo \n-- ASCII string 1 --\n; +var_dump(bin2hex(iconv_substr($string_ascii, 3))); + +echo \n-- ASCII string 2 --\n; +var_dump(bin2hex(iconv_substr($string_ascii, 3, 5, 'ISO-8859-1'))); + +echo \n-- Multibyte string 1
[PHP-CVS] cvs: phpruntests /code-samples/taskScheduler/example3 main.php
g2 Sat Jun 13 14:25:02 2009 UTC Modified files: /phpruntests/code-samples/taskScheduler/example3main.php Log: phpruntests - minor bugfix taskScheduler http://cvs.php.net/viewvc.cgi/phpruntests/code-samples/taskScheduler/example3/main.php?r1=1.1r2=1.2diff_format=u Index: phpruntests/code-samples/taskScheduler/example3/main.php diff -u phpruntests/code-samples/taskScheduler/example3/main.php:1.1 phpruntests/code-samples/taskScheduler/example3/main.php:1.2 --- phpruntests/code-samples/taskScheduler/example3/main.php:1.1Sat Jun 13 03:13:31 2009 +++ phpruntests/code-samples/taskScheduler/example3/main.phpSat Jun 13 14:25:01 2009 @@ -25,6 +25,8 @@ $name = $file-getFileName(); if (substr($name,0,1) == '.') continue; + + if ($name == 'CVS') continue; if ($file-isDir()) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl php_spl.c /ext/spl/tests spl_autoload_bug48541.phpt
cellog Sat Jun 13 17:28:35 2009 UTC Added files: /php-src/ext/spl/tests spl_autoload_bug48541.phpt Modified files: /php-src/ext/splphp_spl.c Log: fix Bug #48541: spl_autoload_register only registers first closure, then leaks the others http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.158r2=1.159diff_format=u Index: php-src/ext/spl/php_spl.c diff -u php-src/ext/spl/php_spl.c:1.158 php-src/ext/spl/php_spl.c:1.159 --- php-src/ext/spl/php_spl.c:1.158 Tue Jun 9 01:57:57 2009 +++ php-src/ext/spl/php_spl.c Sat Jun 13 17:28:35 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_spl.c,v 1.158 2009/06/09 01:57:57 scottmac Exp $ */ +/* $Id: php_spl.c,v 1.159 2009/06/13 17:28:35 cellog Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -503,8 +503,24 @@ alfi.func_ptr = fcc.function_handler; obj_ptr = fcc.object_ptr; if (Z_TYPE_P(zcallable) == IS_OBJECT) { + zstr lc_name; + + size_t func_name_len = Z_UNISIZE(zfunc_name); + alfi.closure = zcallable; Z_ADDREF_P(zcallable); + + lc_name.v = Z_UNIVAL(zfunc_name).v = erealloc(Z_UNIVAL(zfunc_name).v, func_name_len + 2 + sizeof(zcallable-value.obj.handle)); + memcpy(lc_name.s + func_name_len, (zcallable-value.obj.handle), sizeof(zcallable-value.obj.handle)); + func_name_len += sizeof(zcallable-value.obj.handle); + if (Z_TYPE(zfunc_name) == IS_UNICODE) { + func_name_len /= sizeof(UChar); + Z_STRLEN(zfunc_name) = func_name_len; + lc_name.u[func_name_len] = 0; + } else { + Z_STRLEN(zfunc_name) = func_name_len; + lc_name.s[func_name_len] = '\0'; + } } if (error) { efree(error); @@ -512,6 +528,9 @@ zend_u_str_tolower(Z_TYPE(zfunc_name), Z_UNIVAL(zfunc_name), Z_UNILEN(zfunc_name)); if (SPL_G(autoload_functions) zend_u_hash_exists(SPL_G(autoload_functions), Z_TYPE(zfunc_name), Z_UNIVAL(zfunc_name), Z_UNILEN(zfunc_name)+1)) { + if (alfi.closure) { + Z_DELREF_P(zcallable); + } goto skip; } http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/spl_autoload_bug48541.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/spl_autoload_bug48541.phpt +++ php-src/ext/spl/tests/spl_autoload_bug48541.phpt --TEST-- SPL: spl_autoload_register() Bug #48541: registering multiple closures fails with memleaks --FILE-- ?php $a = function ($class) { echo a called\n; }; $b = function ($class) { eval('class ' . $class . '{function __construct(){echo foo\n;}}'); echo b called\n; }; spl_autoload_register($a); spl_autoload_register($b); $c = $a; spl_autoload_register($c); $c = new foo; ? ===DONE=== --EXPECT-- a called b called foo ===DONE=== -- 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 /ext/spl php_spl.c /ext/spl/tests spl_autoload_bug48541.phpt
cellog Sat Jun 13 17:30:50 2009 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests spl_autoload_bug48541.phpt Modified files: /php-srcNEWS /php-src/ext/splphp_spl.c Log: fix Bug #48541: spl_autoload_register only registers first closure, then leaks the others. Fix missing erealloc in fix for bug #40091 (PHP_5_3 only) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.625r2=1.2027.2.547.2.965.2.626diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.625 php-src/NEWS:1.2027.2.547.2.965.2.626 --- php-src/NEWS:1.2027.2.547.2.965.2.625 Sat Jun 13 16:43:04 2009 +++ php-src/NEWSSat Jun 13 17:30:49 2009 @@ -3,8 +3,12 @@ ?? ??? 2009, PHP 5.3.0 RC 4 - Added phar.phar generation for Windows. (Greg) +- Fixed bug #48541 (spl_autoload_register only registers first closure, then + leaks the others). (Greg) - Fixed bug #48533 (__callStatic is not invoked for private/protected methods). (Felipe) +- Fixed missing erealloc() in fix for Bug #40091 in spl_autoload_register. + (Greg) 11 Jun 2009, PHP 5.3.0 RC 3 - Upgraded bundled sqlite to version 3.6.14.2. (Scott, Ilia) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.17.2.37r2=1.52.2.28.2.17.2.38diff_format=u Index: php-src/ext/spl/php_spl.c diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.37 php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.38 --- php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.37 Tue Jun 9 01:58:07 2009 +++ php-src/ext/spl/php_spl.c Sat Jun 13 17:30:50 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_spl.c,v 1.52.2.28.2.17.2.37 2009/06/09 01:58:07 scottmac Exp $ */ +/* $Id: php_spl.c,v 1.52.2.28.2.17.2.38 2009/06/13 17:30:50 cellog Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -497,10 +497,6 @@ alfi.ce = fcc.calling_scope; alfi.func_ptr = fcc.function_handler; obj_ptr = fcc.object_ptr; - if (Z_TYPE_P(zcallable) == IS_OBJECT) { - alfi.closure = zcallable; - Z_ADDREF_P(zcallable); - } if (error) { efree(error); } @@ -509,12 +505,27 @@ zend_str_tolower_copy(lc_name, func_name, func_name_len); efree(func_name); + if (Z_TYPE_P(zcallable) == IS_OBJECT) { + alfi.closure = zcallable; + Z_ADDREF_P(zcallable); + + lc_name = erealloc(lc_name, func_name_len + 2 + sizeof(zcallable-value.obj.handle)); + memcpy(lc_name + func_name_len, (zcallable-value.obj.handle), + sizeof(zcallable-value.obj.handle)); + func_name_len += sizeof(zcallable-value.obj.handle); + lc_name[func_name_len] = '\0'; + } + if (SPL_G(autoload_functions) zend_hash_exists(SPL_G(autoload_functions), (char*)lc_name, func_name_len+1)) { + if (alfi.closure) { + Z_DELREF_P(zcallable); + } goto skip; } if (obj_ptr !(alfi.func_ptr-common.fn_flags ZEND_ACC_STATIC)) { /* add object id to the hash to ensure uniqueness, for more reference look at bug #40091 */ + lc_name = erealloc(lc_name, func_name_len + 2 + sizeof(zend_object_handle)); memcpy(lc_name + func_name_len, Z_OBJ_HANDLE_P(obj_ptr), sizeof(zend_object_handle)); func_name_len += sizeof(zend_object_handle); lc_name[func_name_len] = '\0'; http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/spl_autoload_bug48541.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/spl_autoload_bug48541.phpt +++ php-src/ext/spl/tests/spl_autoload_bug48541.phpt --TEST-- SPL: spl_autoload_register() Bug #48541: registering multiple closures fails with memleaks --FILE-- ?php $a = function ($class) { echo a called\n; }; $b = function ($class) { eval('class ' . $class . '{function __construct(){echo foo\n;}}'); echo b called\n; }; spl_autoload_register($a); spl_autoload_register($b); $c = $a; spl_autoload_register($c); $c = new foo; ? ===DONE=== --EXPECT-- a called b called foo ===DONE=== -- 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
cellog Sat Jun 13 17:34:22 2009 UTC Modified files: (Branch: PHP_5_3) /php-srcNEWS Log: remove missing erealloc entry that will go in php 5.2 NEWS http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.626r2=1.2027.2.547.2.965.2.627diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.626 php-src/NEWS:1.2027.2.547.2.965.2.627 --- php-src/NEWS:1.2027.2.547.2.965.2.626 Sat Jun 13 17:30:49 2009 +++ php-src/NEWSSat Jun 13 17:34:21 2009 @@ -7,8 +7,6 @@ leaks the others). (Greg) - Fixed bug #48533 (__callStatic is not invoked for private/protected methods). (Felipe) -- Fixed missing erealloc() in fix for Bug #40091 in spl_autoload_register. - (Greg) 11 Jun 2009, PHP 5.3.0 RC 3 - Upgraded bundled sqlite to version 3.6.14.2. (Scott, Ilia) -- 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/spl php_spl.c
cellog Sat Jun 13 17:35:38 2009 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/ext/splphp_spl.c Log: fix missing erealloc in fix for bug #40091, spl_autoload_register of more than 1 copy of the same method in different objects http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1555r2=1.2027.2.547.2.1556diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1555 php-src/NEWS:1.2027.2.547.2.1556 --- php-src/NEWS:1.2027.2.547.2.1555Fri Jun 12 20:50:58 2009 +++ php-src/NEWSSat Jun 13 17:35:37 2009 @@ -3,6 +3,8 @@ ?? Jun 2009, PHP 5.2.10 - Fixed bug #48514 (cURL extension uses same resource name for simple and multi APIs). (Felipe) +- Fixed missing erealloc() in fix for Bug #40091 in spl_autoload_register. + (Greg) 11 Jun 2009, PHP 5.2.10RC2 - Updated timezone database to version 2009.9 (2009i) (Derick) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.20r2=1.52.2.28.2.21diff_format=u Index: php-src/ext/spl/php_spl.c diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.20 php-src/ext/spl/php_spl.c:1.52.2.28.2.21 --- php-src/ext/spl/php_spl.c:1.52.2.28.2.20Wed Dec 31 11:17:43 2008 +++ php-src/ext/spl/php_spl.c Sat Jun 13 17:35:37 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_spl.c,v 1.52.2.28.2.20 2008/12/31 11:17:43 sebastian Exp $ */ +/* $Id: php_spl.c,v 1.52.2.28.2.21 2009/06/13 17:35:37 cellog Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -464,6 +464,7 @@ if (obj_ptr !(alfi.func_ptr-common.fn_flags ZEND_ACC_STATIC)) { /* add object id to the hash to ensure uniqueness, for more reference look at bug #40091 */ + lc_name = erealloc(lc_name, func_name_len + 2 + sizeof(zend_object_handle)); memcpy(lc_name + func_name_len, Z_OBJ_HANDLE_PP(obj_ptr), sizeof(zend_object_handle)); func_name_len += sizeof(zend_object_handle); lc_name[func_name_len] = '\0'; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php