Luracast / Restler

Simple and effective multi-format Web API Server to host your PHP API as Pragmatic REST and/or RESTful API
http://luracast.com/products/restler/
GNU Lesser General Public License v2.1
1.36k stars 316 forks source link

respond() method calling a method on a class name instead of an object #299

Closed barros001 closed 10 years ago

barros001 commented 10 years ago

On file restler/vendor/Luracast/Restler/Restler.php respond() method is calling the __getWWWAuthenticateString() on a class name:

        $this->dispatch('complete');
        if ($this->responseCode == 401)
            @header('WWW-Authenticate: ' . (@$this->authClasses[0]->__getWWWAuthenticateString() ? : 'Custom'), false);
        exit;

$this->authClasses is an array of class names, and not objects. This results in a fatal error every time a request returns a response code 401:

Message: Call to a member function __getWWWAuthenticateString() on a non-object

Arul- commented 10 years ago

@barros001 thanks for pointing it out :+1: Apologies for the delay on our side!

barros001 commented 10 years ago

@Arul- looks like 18f67f4 has some extra __ on the method call:

? Scope::get($this->authClasses[0])->____getWWWAuthenticateString()

The iAuthenticate interface define it as __getWWWAuthenticateString

Arul- commented 10 years ago

Yes! I fixed it in 090c084636bc840fd98622fd4ca8b034b99206b4

barros001 commented 10 years ago

Cool, thanks!