Bug #79469 [NEW]: Property access is not allowed yet on a non-initlized connection
| From: | morozov at tut dot by | Date: | Sun, 12 Apr 2020 19:00:51 +0000 |
| Subject: | Bug #79469 [NEW]: Property access is not allowed yet on a non-initlized connection | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-226544@lists.php.net to get a copy of this message | ||
From: morozov at tut dot by
Operating system: Linux
PHP version: master-Git-2020-04-12 (Git)
Package: MySQLi related
Bug Type: Bug
Bug description:Property access is not allowed yet on a non-initlized connection
Description:
------------
When handling connection exceptions, Doctrine DBAL uses the
mysqli::$sqlstate property of the connection. Prior to PHP 8, access to
the property of a non-initialized connection would result in a warning
and returned false: In PHP 8 the warning got promoted to a fatal error.
There doesn't seem to be a way to see if the connection is initialized,
so it might make sense to just return false there and not raise an
error.
Additionally, the possible false value of the property is not documented
in https://www.php.net/manual/en/class.mysqli.php
which leads to
false-positive issues during static analysis.
Test script:
---------------
var_dump(mysqli_init()->sqlstate);
Expected result:
----------------
false
Actual result:
--------------
Fatal error: Uncaught Error: Property access is not allowed yet
--
Edit bug report at https://bugs.php.net/bug.php?id=79469&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79469&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79469&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79469&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79469&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79469&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79469&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79469&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79469&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79469&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79469&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79469&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79469&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79469&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79469&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79469&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79469&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79469&r=mysqlcfg