Bug #65055 [Asn->Csd]: new Operator shuld never return a NULL new ResourceBundle

From: Date: Fri, 11 Dec 2015 20:10:30 +0000
Subject: Bug #65055 [Asn->Csd]: new Operator shuld never return a NULL new ResourceBundle
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197812@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65055&edit=1 ID: 65055 Updated by: danack@php.net Reported by: goetas at lignano dot it Summary: new Operator shuld never return a NULL new ResourceBundle -Status: Assigned +Status: Closed Type: Bug Package: I18N and L10N related Operating System: ubuntu 12.04 PHP Version: 5.4.16 Assigned To: danack Block user comment: N Private report: N New Comment: This is implemented in PHP 7, where all constructors now either succeed or throw an exception. Previous Comments: ------------------------------------------------------------------------ [2015-03-23 18:52:27] cmb@php.net There is a respective RFC[1], which is likely to pass, in which case this bug can be closed. [1] <https://wiki.php.net/rfc/internal_constructor_behaviour> ------------------------------------------------------------------------ [2013-06-25 10:36:59] laruence@php.net hmm, there are also some similar cases in file info ------------------------------------------------------------------------ [2013-06-25 07:06:15] goetas at lignano dot it Similar behaviour has been verified with NumberFormatter class ------------------------------------------------------------------------ [2013-06-24 03:14:19] felipe@php.net 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

« previous php.bugs (#197812) next »