php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78865 Does not check information from the "GET data" correctly
Submitted: 2019-11-23 12:34 UTC Modified: 2019-11-23 12:46 UTC
From: facemxd at hotmail dot com Assigned: cmb (profile)
Status: Not a bug Package: *Regular Expressions
PHP Version: 7.3.12 OS: windows 10 x64
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: facemxd at hotmail dot com
New email:
PHP Version: OS:

 

 [2019-11-23 12:34 UTC] facemxd at hotmail dot com
Description:
------------
hi PHP
I write a function. only numbers turn true. but it returns true when you get parameter add the # character
 
test.php file code :
 

why does it give such an error? I just detected the # character.
please help me, what is the problem?. have a nice day :)

testing info : XAMPP & PHP 7.3.1 & x64 win10 & chrome 78

Test script:
---------------
// test.php 
function number_is_valid($get_data){
    return ( preg_match('/[^0-9]/', $get_data) ) ? "NO" : "YES";
}
 
$data = $_GET['number'];
$result = number_is_valid($data);
 
print_r($result);
 

Testing results :

test.php?number=a4
// result NO
 
test.php?number=4
// result YES
 
test.php?number=4#
// result YES
 
test.php?number=4#@#
// result YES
 
but no problem with data from variable
 
$data = "4#";
$result = number_is_valid($data);
// result NO
 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-11-23 12:46 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Type: Security +Type: Bug -Assigned To: +Assigned To: cmb
 [2019-11-23 12:46 UTC] cmb@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

For a start, do

  var_dump($_GET['number']);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC