felipe          Sun May 10 20:15:39 2009 UTC

  Added files:                 
    /php-src/ext/intl/tests     bug48227.phpt 

  Modified files:              
    /php-src/ext/intl/formatter formatter_format.c 
  Log:
  - Fixed bug #48227 (NumberFormatter::format leaks memory)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/intl/formatter/formatter_format.c?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/intl/formatter/formatter_format.c
diff -u php-src/ext/intl/formatter/formatter_format.c:1.4 
php-src/ext/intl/formatter/formatter_format.c:1.5
--- php-src/ext/intl/formatter/formatter_format.c:1.4   Tue Mar 10 23:39:26 2009
+++ php-src/ext/intl/formatter/formatter_format.c       Sun May 10 20:15:39 2009
@@ -53,11 +53,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