Git Product home page Git Product logo

json-rpc-php's People

Contributors

pozo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

json-rpc-php's Issues

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

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.

Using named parameters

In JsonRpcServer#183 call_user_func_array expects an array, but when using named parameters $requestObject->params is an object. Other than that, the parameters are correctly reordered via introspection, we just need to cast it to array.

   private function call($methodOwnerService, $requestObject) {
    $callbackFunction = array($methodOwnerService,$requestObject->method);
    return call_user_func_array($callbackFunction, (array) $requestObject->params);
}

License

Is this project Open Source? If you don't add a license, it's not Open Source even if the code is public.

Use spl_autoload_register instead of __autoload

__autoload is discouraged because it's usually makes problems when using different frameworks which are all using the autoload feature.
It would be great to see this changed in this library!

jsonRPCClient with Assoc. Array Parameters

I need to send associative array as parameter via json rpc

for example.

{"sendDate":"2013-07-06", "packageId":1}

But if i type like
$myExample->getContent(array('sendDate' => '2013-06-17', 'packageId' => 1));

the $params wil show
[{"sendDate":"2013-07-06", "packageId":1}]

So it not correct.

I think there must be a fix near here.

    if (is_array($params)) {
        // no keys
        $params = array_values($params);

using array_pop instead of array_values work fine.

Please advise

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.