Edit report at https://bugs.php.net/bug.php?id=65055&edit=1
ID: 65055
User updated by: goetas at lignano dot it
Reported by: goetas at lignano dot it
Summary: new Operator shuld never return a NULL new
ResourceBundle
Status: Assigned
Type: Bug
Package: I18N and L10N related
Operating System: ubuntu 12.04
PHP Version: 5.4.16
Assigned To: stas
Block user comment: N
Private report: N
New Comment:
Similar behaviour has been verified with NumberFormatter class
Previous Comments:
------------------------------------------------------------------------
[2013-06-24 03:14:19] [email protected]
Seems it is not the only class which has such behavior.
------------------------------------------------------------------------
[2013-06-18 07:59:01] goetas at lignano dot it
Description:
------------
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.
http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.new
"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
https://github.com/symfony/Intl/blob/master/ResourceBundle/Reader/BinaryBundleReader.php
Test script:
---------------
sapi/cli/php -r 'var_dump(new \ResourceBundle("ANY WRONG PATH", "it"));'
Expected result:
----------------
Thrown some exception
Actual result:
--------------
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65055&edit=1