Bug #79591 [NEW]: mysqli::$errno not an integer after connection close

From: Date: Tue, 12 May 2020 15:56:20 +0000
Subject: Bug #79591 [NEW]: mysqli::$errno not an integer after connection close
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227016@lists.php.net to get a copy of this message
From:             vedad at kajtaz dot net
Operating system: FreeBSD 12.1-RELEASE
PHP version:      7.4.5
Package:          MySQLi related
Bug Type:         Bug
Bug description:mysqli::$errno not an integer after connection close

Description:
------------
The documentation states that mysqli::$errno is an integer.

Once the mysqli connection was closed, it resolves to boolean false
instead.

This is annoying when mysqli::$errno is being passed as second argument
to \Throwable, which triggers an Error with strict_types enabled.

Test script:
---------------
$mysqli = mysqli_init();

assert(is_int($mysqli->errno) && 'before connect');

assert($mysqli->real_connect(...));

assert(is_int($mysqli->errno) && 'before close');

$mysqli->close();

assert(is_int($mysqli->errno) && 'after close');


Actual result:
--------------
PHP Fatal error:  Uncaught AssertionError: assert(is_int($mysqli->errno)
&& 'after close')

-- 
Edit bug report at https://bugs.php.net/bug.php?id=79591&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=79591&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=79591&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=79591&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=79591&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=79591&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=79591&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=79591&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=79591&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=79591&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=79591&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79591&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=79591&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=79591&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=79591&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=79591&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=79591&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=79591&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#227016) next »