php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #56810 input_get octal and hexa
Submitted: 2006-01-31 10:08 UTC Modified: 2006-01-31 14:13 UTC
From: x dot philbert at pixandlog dot com Assigned: derick (profile)
Status: Closed Package: filter (PECL)
PHP Version: 5.1.1 OS: Linux Gentoo
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
16 + 28 = ?
Subscribe to this entry?

 
 [2006-01-31 10:08 UTC] x dot philbert at pixandlog dot com
Description:
------------
Hello,
i don't understand filter on octal and hexa. Why input_get return one error on '-01' or '-0xF' in $_GET|POST ?

Here: http://www.php.net/manual/en/language.types.integer.php
decimal     : [1-9][0-9]*
            | 0

hexadecimal : 0[xX][0-9a-fA-F]+

octal       : 0[0-7]+

integer     : [+-]?decimal
            | [+-]?hexadecimal
            | [+-]?octal

With octal value, it's not possible to send '00', why ?

logical_filters.c
/* state 0 */
if (*p == '-' || *p == '+') {
  ctx_multiply = *p == '-' ? -1 : 1; p++; goto stateI1; <<<=== Why not continue to Octal or Hexa goto ?
} else {
  goto stateOH1;
}

Thank you for your work.


Expected result:
----------------
I expect negatives values for negatives input.
I expect a value equal at 0 for octal value 00.

Actual result:
--------------
$source = INPUT_GET;
$name = 'foo';

$ret = input_get($source, $name, array('flags' => Filter::FILTER_FLAG_ALLOW_OCTAL));

echo '$ret = '; echo $ret;


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-31 14:13 UTC] derick@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

This was not supposed to work, and therefore I reclassified it as Feature Request. I committed a change to CVS that implemented this FR.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 07:01:29 2024 UTC