#47752 [Tbd->Csd]: FILTER_VALIDATE_INT doesn't allow "+0" and "-0"
| From: | vrana@php.net | Date: | Wed, 25 Nov 2009 10:41:59 +0000 |
| Subject: | #47752 [Tbd->Csd]: FILTER_VALIDATE_INT doesn't allow "+0" and "-0" | ||
| References: | 1 | Groups: | php.bugs php.doc.bugs |
| Request: | Send a blank email to php-bugs+get-145063@lists.php.net to get a copy of this message | ||
ID: 47752
Updated by: vrana@php.net
Reported By: for-bugs at hnw dot jp
-Status: To be documented
+Status: Closed
Bug Type: Filter related
Operating System: *
PHP Version: 5.2.9
Assigned To: pajoye
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2009-11-25 10:41:57] svn@php.net
Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&revision=291299
Log: Numbers +0 and -0 (bug #47752)
------------------------------------------------------------------------
[2009-03-24 16:20:07] scottmac@php.net
The documentation should probably mention that +0 and -0 are valid
floats.
var_dump(filter_var("+0", FILTER_VALIDATE_FLOAT));
var_dump(filter_var("-0", FILTER_VALIDATE_FLOAT));
------------------------------------------------------------------------
[2009-03-24 15:22:37] pajoye@php.net
Make it a documentation bug instead, it should be documented and will
be, will add some other things while being at it :)
------------------------------------------------------------------------
[2009-03-24 15:15:17] pajoye@php.net
We have double checked again the design choices about -/+ 0, it was on
purpose. -0 or +0 are not valid integers.
Sorry, but we have to reject this request.
thanks for your understanding,
------------------------------------------------------------------------
[2009-03-24 15:03:53] peter at lvp-media dot com
Hereby a simple bug47752.phpt file. Tested it on a patched- an an
unpatched installation, results as expected. Strictly speaking +0 and -0
are valid integers, even though neither of them is positive or
negative.
Peter Beverloo
--TEST--
Bug #47752 (FILTER_VALIDATE_INT doesn't allow "+0" and "-0")
--FILE--
<?php
$positive = filter_var ('+0', FILTER_VALIDATE_INT);
$negative = filter_var ('-0', FILTER_VALIDATE_INT);
$zero = filter_var ('0', FILTER_VALIDATE_INT);
$octal = filter_var ('-0123', FILTER_VALIDATE_INT);
var_dump ($positive);
var_dump ($negative);
var_dump ($zero);
var_dump ($octal);
?>
--EXPECT--
int(0)
int(0)
int(0)
bool(false)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/47752
--
Edit this bug report at http://bugs.php.net/?id=47752&edit=1