#50701 [Opn->Bgs]: If MySQLi fails it must return a fatal error

From: Date: Sat, 09 Jan 2010 03:21:57 +0000
Subject: #50701 [Opn->Bgs]: If MySQLi fails it must return a fatal error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-146471@lists.php.net to get a copy of this message
ID: 50701 Updated by: johannes@php.net Reported By: gmblar+php at gmail dot com -Status: Open +Status: Bogus Bug Type: MySQLi related Operating System: * PHP Version: 5.3.1 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2010-01-09 03:21:32] johannes@php.net A fatal error can not be handled in any way, so the user would get an empty page (as every serious production system has display_errors off, else it shows confidential info) Instead you have to check for error which gives you the possibility to create a nice error page shown to your users. ------------------------------------------------------------------------ [2010-01-08 22:40:37] gmblar+php at gmail dot com Description: ------------ If MySQLi fails it must return a fatal error. A Warning is not enough. Reproduce code: --------------- <?php $database = new MySQLi('127.0.0.1', 'invalid', 'invalid'); ?> Expected result: ---------------- Fatal error: mysqli::mysqli(): (28000/1045): Access denied for user 'invalid'@'localhost' (using password: YES) in /- on line 3 Actual result: -------------- Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'invalid'@'localhost' (using password: YES) in /- on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50701&edit=1

« previous php.bugs (#146471) next »