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 Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or 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

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

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: Thu Mar 28 18:01:29 2024 UTC