Bug #62794 [Opn->Nab]: print_r with debug_backtrace overwrites member variable
| From: | laruence@php.net | Date: | Sat, 11 Aug 2012 08:19:26 +0000 |
| Subject: | Bug #62794 [Opn->Nab]: print_r with debug_backtrace overwrites member variable | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172542@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62794&edit=1
ID: 62794
Updated by: laruence@php.net
Reported by: burakg at torreycommerce dot com
Summary: print_r with debug_backtrace overwrites member
variable
-Status: Open
+Status: Not a bug
Type: Bug
Package: MySQLi related
Operating System: CentOS 6.3
PHP Version: 5.3.15
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
when you print_r the mysqli object, it will can a static method of mysql , which
also be considered as a operation, if it was executed successful, then empty
error info will be set.
following method act the same :
class Db extends mysqli {
function f() {
$this->query("select");
var_dump($this->error);
print_r($this, true);
var_dump($this->error);
}
}
Previous Comments:
------------------------------------------------------------------------
[2012-08-10 20:43:12] burakg at torreycommerce dot com
Description:
------------
Calling print_r(debug_backtrace()) from a method of a class that inherits from
mysqli overwrites the error member variable. Calling debug_backtrace() on its own
doesn't seem to cause any problems, but when combined with print_r, this problem
results.
Test script:
---------------
<?php
class Db extends mysqli {
function f() {
$this->query("select");
var_dump($this->error);
print_r(debug_backtrace(), true);
var_dump($this->error);
}
}
$db = new Db("host", "user", "password", "database");
$db->f();
Expected result:
----------------
string(146) "You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at
line 1"
string(146) "You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at
line 1"
Actual result:
--------------
string(146) "You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at
line 1"
string(0) ""
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62794&edit=1