Skip to content

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

Description

@DyanGalih

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions