Bug #79469 [Com]: Property access is not allowed yet on a non-initlized connection

From: Date: Mon, 13 Apr 2020 00:02:10 +0000
Subject: Bug #79469 [Com]: Property access is not allowed yet on a non-initlized connection
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226545@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79469&edit=1 ID: 79469 Comment by: bugreports at gmail dot com Reported by: morozov at tut dot by Summary: Property access is not allowed yet on a non-initlized connection Status: Open Type: Bug Package: MySQLi related Operating System: Linux PHP Version: master-Git-2020-04-12 (Git) Block user comment: N Private report: N New Comment: > var_dump(mysqli_init()->sqlstate); that code make sno sense at all Previous Comments: ------------------------------------------------------------------------ [2020-04-12 19:00:51] morozov at tut dot by 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 this bug report at https://bugs.php.net/bug.php?id=79469&edit=1

« previous php.bugs (#226545) next »