|  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: Assigned: ab (profile)
Status: Closed Package: intl (PECL)
PHP Version: 7.0.0RC2 OS:
Private report: No CVE-ID: None
 [2015-09-07 15:16 UTC]
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 or use the script below:

var_dump(IntlChar::charFromName("RECYCLING SYMBOL FOR TYPE-1 PLASTICS"));


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


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

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Dec 11 03:01:27 2023 UTC