felipe          Sun May 10 20:17:22 2009 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/intl/tests     bug48227.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/intl/formatter formatter_format.c 
  Log:
  - Fixed bug #48227 (NumberFormatter::format leaks memory)
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.594&r2=1.2027.2.547.2.965.2.595&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.594 
php-src/NEWS:1.2027.2.547.2.965.2.595
--- php-src/NEWS:1.2027.2.547.2.965.2.594       Sat May  9 21:06:59 2009
+++ php-src/NEWS        Sun May 10 20:17:21 2009
@@ -6,6 +6,7 @@
 
 - Disabled SQLite3::loadExtension for threaded SAPIs. (Scott)
 
+- Fixed bug #48227 (NumberFormatter::format leaks memory). (Felipe)
 
 07 May 2009, PHP 5.3.0 RC 2
 - Upgraded bundled sqlite to version 3.6.13. (Ilia)
http://cvs.php.net/viewvc.cgi/php-src/ext/intl/formatter/formatter_format.c?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/intl/formatter/formatter_format.c
diff -u php-src/ext/intl/formatter/formatter_format.c:1.1.2.2 
php-src/ext/intl/formatter/formatter_format.c:1.1.2.3
--- php-src/ext/intl/formatter/formatter_format.c:1.1.2.2       Mon Aug 11 
19:48:00 2008
+++ php-src/ext/intl/formatter/formatter_format.c       Sun May 10 20:17:21 2009
@@ -54,11 +54,7 @@
 
        if(type == FORMAT_TYPE_DEFAULT) {
                if(Z_TYPE_PP(number) == IS_STRING) {
-                       SEPARATE_ZVAL_IF_NOT_REF(number);
-                       if 
((Z_TYPE_PP(number)=is_numeric_string(Z_STRVAL_PP(number), Z_STRLEN_PP(number), 
-                               &Z_LVAL_PP(number), &Z_DVAL_PP(number), 1)) == 
0) {
-                               ZVAL_LONG(*number, 0);
-                       }
+                       convert_scalar_to_number_ex(number);
                }
 
                if(Z_TYPE_PP(number) == IS_LONG) {

http://cvs.php.net/viewvc.cgi/php-src/ext/intl/tests/bug48227.phpt?view=markup&rev=1.1
Index: php-src/ext/intl/tests/bug48227.phpt
+++ php-src/ext/intl/tests/bug48227.phpt
--TEST--
Bug #48227 (NumberFormatter::format leaks memory)
--FILE--
<?php

$x = new NumberFormatter('en_US', NumberFormatter::DECIMAL);
var_dump($x->format(''));
var_dump($x->format(1));
var_dump($x->format(NULL));
var_dump($x->format($x));

?>
--EXPECTF--
string(1) "0"
string(1) "1"
string(1) "0"

Notice: Object of class NumberFormatter could not be converted to int in %s on 
line %d
string(1) "1"



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to