]> granicus.if.org Git - php/commitdiff
-#7715, fix float validation when using '.23' or '123'
authorPierre Joye <pajoye@php.net>
Thu, 25 May 2006 13:27:51 +0000 (13:27 +0000)
committerPierre Joye <pajoye@php.net>
Thu, 25 May 2006 13:27:51 +0000 (13:27 +0000)
 have worked before using my version, bug introduced in later commits.

ext/filter/tests/bug7715.phpt [new file with mode: 0644]

diff --git a/ext/filter/tests/bug7715.phpt b/ext/filter/tests/bug7715.phpt
new file mode 100644 (file)
index 0000000..9e1206f
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+bug 7715, floats value with integer or incomplete input
+--FILE--
+<?php
+$data = array(
+       '.23',
+       '-42',
+       '+42',
+       '.4',
+       '-.4',
+       '1000000000000',
+       '-1000000000000'
+);
+foreach ($data as $val) {
+       $res = filter_data($val, FILTER_VALIDATE_FLOAT);
+       var_dump($res);
+}
+echo "\n";
+?>
+--EXPECTF--    
+float(0.23)
+float(-42)
+float(42)
+float(0.4)
+float(-0.4)
+float(1.0E+12)
+float(-1.0E+12)