Bug #78666 [Opn->Ver]: mysqli_options generates Warning on var_dump()

From: Date: Thu, 07 Nov 2019 10:44:59 +0000
Subject: Bug #78666 [Opn->Ver]: mysqli_options generates Warning on var_dump()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223624@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78666&edit=1 ID: 78666 Updated by: nikic@php.net Reported by: r at roze dot lv Summary: mysqli_options generates Warning on var_dump() -Status: Open +Status: Verified Type: Bug Package: MySQLi related -PHP Version: 7.4.0RC3 +PHP Version: 7.3.11 Block user comment: N Private report: N New Comment: This warning should be suppressed in get_debug_info, and possibly all properties for which it triggers not shown. This might require changing the API for the proprety accessors though. Previous Comments: ------------------------------------------------------------------------ [2019-10-12 19:16:51] r at roze dot lv Description: ------------ A simple code: <?php $con = mysqli_init(); mysqli_options( $con, MYSQLI_OPT_CONNECT_TIMEOUT, 2); var_dump($con); or OOP style <?php $con = mysqli_init(); $con->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2); var_dump($con); Generates multiple Warnings - Warning: var_dump(): Property access is not allowed yet in [file] on line 4 I noticed this when running Xdebug with xdebug.collect_params=3 (https://bugs.xdebug.org/view.php?id=1714) but Derick pointed out it not to be Xdebug rather than mysqli problem. Is this expected? While in a production code there probably won't be a var_dump() it makes the development environment problematic and confusing. The workaround for Xdebug is to use OOP style but var_dump() still produces Warnings. Test script: --------------- php -r '$con=mysqli_init();mysqli_options($con,MYSQLI_OPT_CONNECT_TIMEOUT,2);var_dump($con);' Expected result: ---------------- No warning. Actual result: -------------- Warning: var_dump(): Property access is not allowed yet in Command line code on line 1 Warning: var_dump(): Property access is not allowed yet in Command line code on line 1 Warning: var_dump(): Property access is not allowed yet in Command line code on line 1 Warning: var_dump(): Property access is not allowed yet in Command line code on line 1 Warning: var_dump(): Property access is not allowed yet in Command line code on line 1 Warning: var_dump(): Property access is not allowed yet in Command line code on line 1 Warning: var_dump(): Property access is not allowed yet in Command line code on line 1 Warning: var_dump(): Property access is not allowed yet in Command line code on line 1 Warning: var_dump(): Property access is not allowed yet in Command line code on line 1 Warning: var_dump(): Property access is not allowed yet in Command line code on line 1 Warning: var_dump(): Property access is not allowed yet in Command line code on line 1 Warning: var_dump(): Property access is not allowed yet in Command line code on line 1 object(mysqli)#1 (18) { ["affected_rows"]=> bool(false) ["client_info"]=> string(16) "mysqlnd 7.4.0RC3" ["client_version"]=> int(70400) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> int(0) ["error"]=> string(0) "" ["error_list"]=> bool(false) ["field_count"]=> bool(false) ["host_info"]=> bool(false) ["info"]=> bool(false) ["insert_id"]=> bool(false) ["server_info"]=> bool(false) ["server_version"]=> bool(false) ["sqlstate"]=> bool(false) ["protocol_version"]=> bool(false) ["thread_id"]=> bool(false) ["warning_count"]=> bool(false) } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78666&edit=1

« previous php.bugs (#223624) next »