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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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: Thu Nov 21 11:01:29 2024 UTC