From:             
Operating system: Ubuntu 11.04
PHP version:      5.3.8
Package:          intl
Bug Type:         Bug
Bug description:Cannot select rule set when using NumberFormatter with pattern 
rule based

Description:
------------
According to the RuleBasedNumberFormat documentation: http://www.icu-
project.org/apiref/icu4c/classRuleBasedNumberFormat.html#details, a rule
pattern 
string can have multiple rule sets.
When calling the format method, it is possible to select the rule set to
use. 

But it PHP seems that this is not possible in the current implementation:

NumberFormatter::string format ( number $value [, int $type ] )

Notice that $type is an integer and may take only these possible values:
NumberFormatter::TYPE_DEFAULT
NumberFormatter::TYPE_INT32
NumberFormatter::TYPE_INT64
NumberFormatter::TYPE_DOUBLE
NumberFormatter::TYPE_CURRENCY

For rule set selection to work $type should be a string (the rule set
name).


Test script:
---------------
$ruleSet='
%spellout-cardinal:
1:one;
%spellout-ordinal:
1:first;
';

$formatter = new NumberFormatter(null, NumberFormatter::PATTERN_RULEBASED,
$ruleSet);

echo $formatter->format(1, 'spellout-ordinal');

Expected result:
----------------
first

Actual result:
--------------
PHP Warning:  NumberFormatter::format() expects parameter 2 to be long,
string 
given in /home/raducu/Workspace/Spelling/numbers.php on line 12

-- 
Edit bug report at https://bugs.php.net/bug.php?id=60148&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=60148&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=60148&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=60148&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=60148&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60148&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=60148&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=60148&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=60148&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=60148&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=60148&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=60148&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=60148&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=60148&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=60148&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=60148&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60148&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=60148&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=60148&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=60148&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=60148&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=60148&r=mysqlcfg

Reply via email to