jacwright / RestServer

A PHP REST server for providing a very light-weight REST API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug in handle method

guitarneck opened this issue · comments

Hi,

There's a bug when you add an object insteed of a class name string.
It is in 'handle', at line 138. $newObj erase $obj (line 142). Then, eveything failed on Fatal Error.

$newObj doesn't seems necesary anymore at this point. Something like this correct it :

//if (is_string($obj) && !($newObj = $this->instantiateClass($obj))) {
if (is_string($obj) && !($obj = $this->instantiateClass($obj))) {
	throw new Exception("Class $obj does not exist");
}

//$obj = $newObj; don't need this line anymore
$obj->server = $this;

Great job, by the way ! ;)