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

From: Date: Sat, 09 Jan 2010 03:21:33 +0000
Subject: #50701 [Opn]: If MySQLi fails it must return a fatal error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-146470@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 Bug Type: MySQLi related Operating System: * PHP Version: 5.3.1 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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 (#146470) next »