php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74161 var_export values displayed incorrectly
Submitted: 2017-02-24 02:07 UTC Modified: 2017-02-24 06:19 UTC
From: tj dot krause at springscs dot org Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.0.16 OS: Ubuntu 14.04 64 bit
Private report: No CVE-ID: None
 [2017-02-24 02:07 UTC] tj dot krause at springscs dot org
Description:
------------
var_export outputs float values incorrectly.

Test script:
---------------
<?php

var_export(3.3);
var_export(1.0);

var_dump(3.3);
var_dump(1.0);

Expected result:
----------------
var_export(3.3) should display 3.3.

Float values should be converted directly to strings without modification.

Actual result:
--------------
root@app:/backup/mysql# php -a
Interactive mode enabled

php > var_export(1.0);
1.0
php > var_export(3.3);
3.2999999999999998
php > var_dump(1.0);
float(1)
php > var_dump(3.3);
float(3.3)
php >


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-24 06:19 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Package: Reflection related +Package: *General Issues
 [2017-02-24 06:19 UTC] requinix@php.net
var_dump respects the float precision settings. var_export does not so that it can always export the value accurately.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 02 00:01:30 2024 UTC