From:             xing at mac dot com
Operating system: centos 4.2
PHP version:      5.1.2RC1
PHP Bug Type:     Variables related
Bug description:  var_export() generate invalid code

Description:
------------
invalid php code from var_export contrary to documentation claims.

Reproduce code:
---------------
<?


class query_result   {
        
        public $affected_rows = 0; 
        public $num_rows = 0; 
        public $insert_id = 0;

        public $result = array(); //pdo result
        public $pointer = 0;
}


$test = array(
"test" => new query_result()
);

$dump =  var_export($test, TRUE);

file_put_contents("test.txt","<? ". $dump . "?>");

include("test.txt");

die();

?>

Expected result:
----------------
no php error

Actual result:
--------------
PHP Fatal error: Call to undefinied query_result::__set_state() in
test.txt line 3

-- 
Edit bug report at http://bugs.php.net/?id=35846&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=35846&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=35846&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=35846&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35846&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=35846&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35846&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35846&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35846&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35846&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35846&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=35846&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=35846&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35846&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35846&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35846&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35846&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35846&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35846&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35846&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35846&r=mysqlcfg

Reply via email to