Announcement

  •  » Engine
  •  » API format=php does not work

#1 2021-12-04 05:08:43

Zentalquabula
Member
2014-05-10
217

API format=php does not work

An API call using format=php does not work in 12.1.0.

/ws.php?method=pwg.categories.getImages&format=php&per_page=2&recursive=true&order=random%20DESC

Error:

Got error 'PHP message: PHP Fatal error:  Uncaught TypeError: get_class(): Argument #1 ($object) must be of type object, array given in /include/ws_protocols/php_encoder.php:13

Explictly converting to object fixes the problem temporarily.

13: $respClass = strtolower( @get_class((object) $response) );

Offline

 

#2 2021-12-04 12:05:12

erAck
Only trying to help
2015-09-06
2026

Re: API format=php does not work

Works for me. PHP 7.4


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2021-12-04 13:19:39

Zentalquabula
Member
2014-05-10
217

Re: API format=php does not work

PHP 8.1, no workie. An array is passed, but definition requires object:

https://www.php.net/manual/en/function.get-class

get_class(object $object = ?): string

Last edited by Zentalquabula (2021-12-04 13:28:34)

Offline

 

#4 2021-12-04 15:01:42

erAck
Only trying to help
2015-09-06
2026

Re: API format=php does not work

Casting anything to object isn't correct either. This pull request https://github.com/Piwigo/Piwigo/pull/1575 should fix things.

Until merged and released it should be applicable with

Code:

cd YourPiwigoDirectory
curl https://github.com/Piwigo/Piwigo/commit/fa6575d9d4ae08b26853dde036bcd5b6ae5bd13c.patch | patch -p1

Running Piwigo at https://erack.net/gallery/

Offline

 
  •  » Engine
  •  » API format=php does not work

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact