#25874 [NEW]: var_export does not output valid code
| From: | fire at firepages dot com dot au | Date: | Wed, 15 Oct 2003 02:21:48 +0000 |
| Subject: | #25874 [NEW]: var_export does not output valid code | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-49036@lists.php.net to get a copy of this message | ||
From: fire at firepages dot com dot au
Operating system: XP
PHP version: 4.3.3
PHP Bug Type: Variables related
Bug description: var_export does not output valid code
Description:
------------
output from var_export($var,true) has trailing comma so you have to strip
that manually before utilising the returned string.
the manual example shows this behaviour so perhaps its a feature ?
Reproduce code:
---------------
$yaks = array( 'dfdf'=>'a' , 'b' , 'c' , 'd' )
;
echo '$llama = ' . var_export( $yaks , true ) . ' ;' ;
Expected result:
----------------
$llama = array ( 'dfdf' => 'a', 0 => 'b', 1 => 'c',
2 => 'd' ) ;
Actual result:
--------------
$llama = array ( 'dfdf' => 'a', 0 => 'b', 1 => 'c',
2 => 'd', ) ;
--
Edit bug report at http://bugs.php.net/?id=25874&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25874&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25874&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25874&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25874&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25874&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25874&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25874&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25874&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25874&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25874&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25874&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25874&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25874&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25874&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25874&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25874&r=float