From 2cc829a8cfe9e3f95c92acefd1f78ba60026d51e Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 19 Jun 2008 21:13:56 +0000 Subject: [PATCH] Fix PHP 4.3.9/10 bug with float handling git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/branches/php4@1806 48356398-32a2-884e-a903-53898d9a118a --- library/HTMLPurifier/UnitConverter.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library/HTMLPurifier/UnitConverter.php b/library/HTMLPurifier/UnitConverter.php index aa29aaac..d8791cca 100644 --- a/library/HTMLPurifier/UnitConverter.php +++ b/library/HTMLPurifier/UnitConverter.php @@ -93,6 +93,11 @@ class HTMLPurifier_UnitConverter $sigfigs = $this->getSigFigs($n); if ($sigfigs < $this->outputPrecision) $sigfigs = $this->outputPrecision; + // Cleanup $n for PHP 4.3.9 and 4.3.10. See http://bugs.php.net/bug.php?id=30726 + if (strncmp($n, '-.', 2) === 0) { + $n = '-0.' . substr($n, 2); + } + // BCMath's internal precision deals only with decimals. Use // our default if the initial number has no decimals, or increase // it by how ever many decimals, thus, the number of guard digits