Bug->Doc #75448 [Opn]: In case of failure, mysqli::prepare() returns NULL instead of FALSE

From: Date: Sun, 29 Oct 2017 08:29:24 +0000
Subject: Bug->Doc #75448 [Opn]: In case of failure, mysqli::prepare() returns NULL instead of FALSE
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15196@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75448&edit=1 ID: 75448 Updated by: kalle@php.net Reported by: morozov at tut dot by Summary: In case of failure, mysqli::prepare() returns NULL instead of FALSE Status: Open -Type: Bug +Type: Documentation Problem Package: MySQLi related Operating System: Linux PHP Version: 7.1.11 Block user comment: N Private report: N New Comment: I think this is a common thing in the mysqli extension to simply return null if the "active connection" check fails, so instead the docs should be updated to reflect thi Previous Comments: ------------------------------------------------------------------------ [2017-10-28 03:05:15] morozov at tut dot by Description: ------------ According to http://php.net/mysqli_prepare, mysqli_prepare() returns a statement object or FALSE if an error occurred. Under certain circumstances, it also returns NULL which makes error handling harder. Test script: --------------- <?php $conn = mysqli_connect('localhost', 'root', ''); $conn->close(); $stmt = $conn->prepare('SELECT * FROM users'); var_dump($stmt); Expected result: ---------------- The value of $stmt is FALSE. Actual result: -------------- The value of $stmt is NULL. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75448&edit=1

« previous php.doc.bugs (#15196) next »