You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
Zend\Json\Server\Server::addFunction instantiates a new object even if an object is given as a callable.
e.g.
$server->addFunction(array($this, 'remoteProcedure'));
This gets problematic in case the constructor has arguments or the object needs further initialisation.
In contrast to this Zend\Json\Server\Server::setClass reuses the given object.
The behaviour is caused by the difference in the call to
Zend\Server\AbstractServer::_buildSignature
Zend\Json\Server\Server::addFunction instantiates a new object even if an object is given as a callable.
e.g.
$server->addFunction(array($this, 'remoteProcedure'));
This gets problematic in case the constructor has arguments or the object needs further initialisation.
In contrast to this Zend\Json\Server\Server::setClass reuses the given object.
The behaviour is caused by the difference in the call to
Zend\Server\AbstractServer::_buildSignature
setClass:
$definition = $this->_buildSignature($method, $class); (line 133)
addFunction:
$definition = $this->_buildSignature($method); (line 109)
If there are no reasons against it the fix would be
using
$definition = $this->_buildSignature($method, $class);
as well in addFunction.
The text was updated successfully, but these errors were encountered: