php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78666 mysqli_options generates Warning on var_dump()
Submitted: 2019-10-12 19:16 UTC Modified: 2019-11-07 10:44 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: r at roze dot lv Assigned:
Status: Closed Package: MySQLi related
PHP Version: 7.3.11 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: r at roze dot lv
New email:
PHP Version: OS:

 

 [2019-10-12 19:16 UTC] 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)
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-11-07 10:44 UTC] nikic@php.net
-Status: Open +Status: Verified -PHP Version: 7.4.0RC3 +PHP Version: 7.3.11
 [2019-11-07 10:44 UTC] nikic@php.net
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.
 [2020-01-28 17:45 UTC] kocsismate@php.net
Automatic comment on behalf of kocsismate@woohoolabs.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d39edebbce35890aafd77cc47e1830e851287219
Log: Fix #78666 mysqli_options generates Warning on var_dump()
 [2020-01-28 17:45 UTC] kocsismate@php.net
-Status: Verified +Status: Closed
 [2020-01-28 17:53 UTC] kocsismate@php.net
Automatic comment on behalf of kocsismate@woohoolabs.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d39edebbce35890aafd77cc47e1830e851287219
Log: Fix #78666 mysqli_options generates Warning on var_dump()
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 20:01:32 2024 UTC