View Issue Details

IDProjectCategoryView StatusLast Update
0002151XdebugUncategorizedpublic2024-02-19 05:43
Reporterdgoosens Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Product Version3.2.0 
Summary0002151: Xdebug alters the output of floating point numbers in var_dump
Description

when Xdebug is enabled, var_dump() rounds floating point numbers to two digits

Steps To Reproduce

cat test.php

<?php
    var_dump(.2 + .1);
sudo phpenmod xdebug
php test.php
# prints:  double(0.3)
sudo phpdismod xdebug
php test.php
# prints: float(0.30000000000000004)
Additional Information

tested on PHP8.1
PHP 8.1.13 (cli) (built: Nov 26 2022 14:07:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.13, Copyright (c) Zend Technologies
with Zend OPcache v8.1.13, Copyright (c), by Zend Technologies
with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans

and PHP8.2
PHP 8.2.0 (cli) (built: Dec 10 2022 10:53:01) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies
with Zend OPcache v8.2.0, Copyright (c), by Zend Technologies
with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans

TagsNo tags attached.
Operating SystemPop!_OS 22.04 LTS
PHP Version8.1.10-8.1.19

Activities

dgoosens

2022-12-21 22:29

reporter   ~0006499

sorry for the formatting...
was not aware mantis had some kind of MD support now

derick

2023-01-30 19:04

administrator   ~0006510

This seems to be an actual bug in PHP, although this was introduced in 2015 :-)

https://github.com/php/php-src/pull/10475

derick

2023-04-03 17:44

administrator   ~0006545

This should now be fixed with PHP 8.1.17 and 8.2.4 — let me know if it hasn't please.

Paul McGarry

2024-02-19 05:43

reporter   ~0006848

I think this is still a real issue, xdebug is not displaying the internal precision on floats, eg


% php82 --version
PHP 8.2.15 (cli) (built: Jan 27 2024 00:09:28) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.15, Copyright (c) Zend Technologies
with Xdebug v3.3.1, Copyright (c) 2002-2023, by Derick Rethans

% php82 -r "var_dump(3.99+19.99);"
Command line code:1:
double(23.98)


% php83 --version
PHP 8.3.2 (cli) (built: Jan 26 2024 23:59:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.2, Copyright (c) Zend Technologies
with Xdebug v3.3.1, Copyright (c) 2002-2023, by Derick Rethans

% php83 -r "var_dump(3.99+19.99);"
Command line code:1:
double(23.98)

while without xdebug loaded the output is:


float(23.979999999999997)

Issue History

Date Modified Username Field Change
2022-12-21 22:18 dgoosens New Issue
2022-12-21 22:29 dgoosens Note Added: 0006499
2023-01-25 17:50 derick Steps to Reproduce Updated
2023-01-30 19:04 derick Note Added: 0006510
2023-01-30 19:04 derick Assigned To => derick
2023-01-30 19:04 derick Status new => confirmed
2023-04-03 17:44 derick Status confirmed => resolved
2023-04-03 17:44 derick Resolution open => no change required
2023-04-03 17:44 derick Note Added: 0006545
2024-02-19 05:43 Paul McGarry Note Added: 0006848