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: Verified Package: MySQLi related
PHP Version: 7.3.11 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 12 21:01:36 2019 UTC