mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-28 12:19:57 +03:00
issue #1575 PHP 8 compatibility, check for object type
* by using $response instanceof PwgError instead of get_class()
This commit is contained in:
parent
8fbc17c392
commit
8889f7ffef
4 changed files with 4 additions and 6 deletions
|
@ -586,7 +586,7 @@ Request format: ".@$this->_requestFormat." Response format: ".@$this->_responseF
|
||||||
$result = trigger_change('ws_invoke_allowed', true, $methodName, $params);
|
$result = trigger_change('ws_invoke_allowed', true, $methodName, $params);
|
||||||
|
|
||||||
$is_error = false;
|
$is_error = false;
|
||||||
if (is_object($result) and strtolower( get_class($result) ) == 'pwgerror')
|
if ($result instanceof PwgError)
|
||||||
{
|
{
|
||||||
$is_error = true;
|
$is_error = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ class PwgJsonEncoder extends PwgResponseEncoder
|
||||||
{
|
{
|
||||||
function encodeResponse($response)
|
function encodeResponse($response)
|
||||||
{
|
{
|
||||||
if (is_object($response) and strtolower(get_class($response)) == 'pwgerror')
|
if ($response instanceof PwgError)
|
||||||
{
|
{
|
||||||
return json_encode(
|
return json_encode(
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -10,8 +10,7 @@ class PwgSerialPhpEncoder extends PwgResponseEncoder
|
||||||
{
|
{
|
||||||
function encodeResponse($response)
|
function encodeResponse($response)
|
||||||
{
|
{
|
||||||
$respClass = strtolower( @get_class($response) );
|
if ($response instanceof PwgError)
|
||||||
if ($respClass=='pwgerror')
|
|
||||||
{
|
{
|
||||||
return serialize(
|
return serialize(
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -49,8 +49,7 @@ class PwgXmlRpcEncoder extends PwgResponseEncoder
|
||||||
{
|
{
|
||||||
function encodeResponse($response)
|
function encodeResponse($response)
|
||||||
{
|
{
|
||||||
$respClass = strtolower( @get_class($response) );
|
if ($response instanceof PwgError)
|
||||||
if ($respClass=='pwgerror')
|
|
||||||
{
|
{
|
||||||
$code = $response->code();
|
$code = $response->code();
|
||||||
$msg = htmlspecialchars($response->message());
|
$msg = htmlspecialchars($response->message());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue