php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1425 $HTTP_POST_VARS and $HTTP_GET_VARS get all form values in strings.
Submitted: 1999-05-18 20:29 UTC Modified: 1999-05-18 22:00 UTC
From: ukiseal at hotmail dot com Assigned:
Status: Closed Package: Other
PHP Version: 3.0.7 OS:
Private report: No CVE-ID: None
 [1999-05-18 20:29 UTC] ukiseal at hotmail dot com
I have a simple function which goes through some variables gotten from a form using the $HTTP_POST_VARS and $HTTP_GET_VARS, the function checks if something is an int (is_int()) or string (is_string()), but because $HTTP_POST_VARS and $HTTP_GET_VARS set everything to strings I cant get the results that I need. (I'm trying to make a SQL query which puts quotes around strings and nothing around int's)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-05-18 22:00 UTC] rasmus at cvs dot php dot net
Hardly a bug.  That's by design.  What if someone sticks all numbers in a
text field.  Then by your logic you wouldn't put quotes around it and the
SQL database would throw an error.  You need to go by the type of the
field you are putting data into, not by the type of data that you are trying
to put in.

If you really do need to determine the type of the contents of a variable,
there are plenty of functions that let you do that.  Something like:
strspn($string,"1234567890.") 
would be a good start.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Oct 07 12:03:43 2022 UTC