|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[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
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
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