#41909 [NEW]: var_export
| From: | stingbat at stingbat dot dk | Date: | Thu, 05 Jul 2007 17:11:05 +0000 |
| Subject: | #41909 [NEW]: var_export | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-114682@lists.php.net to get a copy of this message | ||
From: stingbat at stingbat dot dk
Operating system: Windows
PHP version: 5.2.3
PHP Bug Type: Variables related
Bug description: var_export
Description:
------------
Seems like there has been a change to the var_export-function, when
comparing PHP4 and PHP5, as stated below:
PHP4
----
314 : case IS_DOUBLE:
315 8 : php_printf("%.*G", (int)
EG(precision), Z_DVAL_PP(struc));
> from:
> http://gcov.php.net/PHP_4_4/lcov_html/ext/standard/var.c.gcov.php
PHP5
----
407 : case IS_DOUBLE:
408 42 : php_printf("%.*H", (int)
EG(precision), Z_DVAL_PP(struc));
> from:
> http://gcov.php.net/PHP_5_2/lcov_html/ext/standard/var.c.gcov.php
Of some reason, the output don't give the same.
I don't know if it's PHP4 that has always had this problem, or if it's a
new problem only existing in PHP5.
However, it gives difficulties, if trying to compare the results or want
to output the results float-values to either JavaScript or Database. And
especially when trying to create scripts that should work on both
PHP-versions (4.x+5.x).
Reproduce code:
---------------
<?php
$test_value = 1.50;
setlocale(LC_ALL, 'da_DK.iso-8859-1', 'da_DK', 'danish',
'da');
echo 'DK: ' . var_export($test_value, TRUE) . "\n";
setlocale(LC_ALL, 'en');
echo 'EN: ' . var_export($test_value, TRUE) . "\n";
echo "\n" . PHP_VERSION;
?>
Expected result:
----------------
DK: 1.5
EN: 1.5
Actual result:
--------------
DK: 1,5
EN: 1.5
--
Edit bug report at http://bugs.php.net/?id=41909&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41909&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41909&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41909&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41909&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41909&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41909&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41909&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41909&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41909&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41909&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41909&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41909&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41909&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41909&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41909&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41909&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41909&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41909&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41909&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41909&r=mysqlcfg