From:             burakg at torreycommerce dot com
Operating system: CentOS 6.3
PHP version:      5.3.15
Package:          MySQLi related
Bug Type:         Bug
Bug description:print_r with debug_backtrace overwrites member variable

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 bug report at https://bugs.php.net/bug.php?id=62794&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62794&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62794&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62794&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62794&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62794&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62794&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62794&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62794&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62794&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62794&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62794&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62794&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62794&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62794&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62794&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62794&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62794&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62794&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62794&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62794&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62794&r=mysqlcfg

Reply via email to