|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-08-07 16:20 UTC] cmb@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: cmb
[2018-08-07 16:20 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 11:00:02 2025 UTC |
Description: ------------ PHP: PHP 5.3.10-1ubuntu3.11 with Suhosin-Patch and PHP 5.5.9-1ubuntu4 (my test env). Appears to span multiple versions. Description: Using SimpleXML Nodes in mathematical equations doesn't correctly convert strings to floats, as expected, but only to integers (stopping at the decimal). Modules: aptitude managed, with cURL installed. Everything else is vanilla. FYI - the "PHP Version" can't be changed on the bug submitting form after an error occurs when submitting asking me to change it.... Test script: --------------- <?php // Does NOT work as expected. $sxml = simplexml_load_string('<test><num>20.5</num><den>1</den></test>'); $ans = $sxml->num / $sxml->den; echo "XML Test:\n"; echo "{$sxml->num} / {$sxml->den} = {$ans}\n"; // Output: 20.5 / 1 = 20 // Works as expected. $num = "20.5"; $den = "1"; $ans = $num / $den; echo "String Test:\n"; echo "{$num} / {$den} = {$ans}\n"; // Output: 20.5 / 1 = 20.5