|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65055 new Operator shuld never return a NULL new ResourceBundle
Submitted: 2013-06-18 07:59 UTC Modified: 2015-12-11 20:10 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: goetas at lignano dot it Assigned: danack (profile)
Status: Closed Package: I18N and L10N related
PHP Version: 5.4.16 OS: ubuntu 12.04
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:
Bug Type:
From: goetas at lignano dot it
New email:
PHP Version: OS:


 [2013-06-18 07:59 UTC] goetas at lignano dot it
sapi/cli/php -v
PHP 5.4.16 (cli) (built: Jun 18 2013 09:34:40) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Instantiating ResourceBundle class, a "new" operator should never return null.

"To create an instance of a class, the new keyword must be used. An object will always be created unless the object has a constructor defined that throws an exception on error."

This behaviour it's also verified by Symfony team

Test script:
sapi/cli/php -r 'var_dump(new \ResourceBundle("ANY WRONG PATH", "it"));'

Expected result:
Thrown some exception

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-24 03:14 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: stas
 [2013-06-24 03:14 UTC]
Seems it is not the only class which has such behavior.
 [2013-06-25 07:06 UTC] goetas at lignano dot it
Similar behaviour has been verified with NumberFormatter class
 [2013-06-25 10:36 UTC]
hmm, there are also some similar cases in file info
 [2015-03-23 18:52 UTC]
-Assigned To: stas +Assigned To: danack
 [2015-03-23 18:52 UTC]
There is a respective RFC[1], which is likely to pass, in which
case this bug can be closed.

[1] <>
 [2015-12-11 20:10 UTC]
-Status: Assigned +Status: Closed
 [2015-12-11 20:10 UTC]
This is implemented in PHP 7, where all constructors now either succeed or throw an exception.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Jun 04 11:03:40 2023 UTC