php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #70451 IntlChar::charFromName() not consistent with C library or HHVM
Submitted: 2015-09-07 15:16 UTC Modified: 2016-04-08 13:34 UTC
From: colinodell@php.net Assigned: ab (profile)
Status: Closed Package: intl (PECL)
PHP Version: 7.0.0RC2 OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: colinodell@php.net
New email:
PHP Version: OS:

 

 [2015-09-07 15:16 UTC] colinodell@php.net
Description:
------------
The IntlChar::charFromName() method returns bool(false) when an invalid name is given.  According to the method signature, only integer values should be returned in this case.

The underlying C library returns "an undefined value if there is no such code point".  According to the RFC for IntlChar, the ICU functionality should "[follow] the ICU API as much as possible".

Furthermore, HHVM's implementation returns null in these cases.

I therefore feel that PHP should also return null in these cases instead of bool(false).  This would make it consistent with the ICU library and HHVM.

Test script:
---------------
See https://3v4l.org/171NK or use the script below:

<?php
var_dump(IntlChar::charFromName("RECYCLING SYMBOL FOR TYPE-1 PLASTICS"));
var_dump(IntlChar::charFromName("sdfasdfasdfasdf"));


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-08 13:34 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2016-04-08 13:34 UTC] ab@php.net
PR is merged into 7.0

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 12 18:01:27 2024 UTC