Bug #75448 [NEW]: In case of failure, mysqli::prepare() returns NULL instead of FALSE
From: morozov at tut dot by
Operating system: Linux
PHP version: 7.1.11
Package: MySQLi related
Bug Type: Bug
Bug description:In case of failure, mysqli::prepare() returns NULL instead of FALSE
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 bug report at https://bugs.php.net/bug.php?id=75448&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75448&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75448&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75448&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75448&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75448&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75448&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75448&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75448&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75448&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75448&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75448&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75448&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75448&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75448&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75448&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75448&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75448&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75448&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75448&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75448&r=mysqlcfg
Thread (2 messages)
- morozov at tut dot by