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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tj dot krause at springscs dot org
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 11:02:27 2025 UTC