json-rpc-php icon indicating copy to clipboard operation
json-rpc-php copied to clipboard

isValidRequestObjectId($requestId) for id json if id between 48-57

Open DyanGalih opened this issue 12 years ago • 0 comments

i try to modivied some script @ JsonRpcServer.class.php:

private function isValidRequestObjectId($requestId) { if(is_string($resquestId)) $resquestId=(float)$resquestId; if(is_null($requestId) OR is_int($requestId)) return true; else return false; /return (is_null($requestId) || is_string($requestId) // 2 and "2" is valid but 2.1 and "2.1" is not || (ctype_digit($requestId) xor is_int($requestId)));/ }

at your code, it will make mistake if $resquest id between 48 to 57. Because return from ctype_digit($requestId) will be true and is_int($requestId) is true. So, the return will be false because xor must not true each other.

DyanGalih avatar Dec 20 '12 09:12 DyanGalih