API working on PHP 7.4, returning NULL on PHP 8.3

Hi!

I have Dolibarr 20.0.2, running on PHP 7.4. Everything is fine. I use REST API quite much. Works like a charm.

However, Dolibarr is the last thing still in PHP 7.4. All other company software is running PHP 8.3, and I would like to get Dolibarr working there also. Well, interactively it works on 8.3 just fine. But there is a problem with the API.

I have a tester code to send a reequest using curl like this:

$action = "thirdparties?sortfield=t.rowid&sortorder=ASC&limit=100&sqlfilters=(t.code_client%3A%3D%3A'A00152')";
$response = json_decode(CallREST("GET", $action));
var_dump($response);

and if my Dolibarr is running on PHP 7.4, it returns rather nicely

array(1) {
  [0] =>
  class stdClass#1 (155) {
    public $module =>
    string(7) "societe"
    public $SupplierCategories =>
    array(0) {
    }
    public $prefixCustomerIsRequired =>
    NULL
    public $entity =>
    string(1) "1"
    public $name =>
    string(18) "Jari-Matti"
    ... and so on ...

but if Dolibarr is running on anyting above PHP 8.0, I get only NULL back!
The error coming back is

string(977) "<br />
<b>Fatal error</b>:  Uncaught TypeError: realpath(): Argument #1 ($path) must be of type string, array given in /home/jardes/www/dolibarr/includes/restler/framework/Luracast/Restler/AutoLoader.php:163
Stack trace:
#0 /home/jardes/www/dolibarr/includes/restler/framework/Luracast/Restler/AutoLoader.php(163): realpath(Array)
#1 [internal function]: Luracast\Restler\AutoLoader-&gt;Luracast\Restler\{closure}(Array)
#2 /home/jardes/www/dolibarr/includes/restler/framework/Luracast/Restler/AutoLoader.php(161"...

Does anyone have any ideas about this?

Thanks for your help in advance,

Hi,

There’s a workaround on this issue in the first post

But it seems that only a few people have this issue. I think this could be a nginx configuration issue.
Do you use nginx ?

Thanks! This workaround solved it! I am not using nginx, but Apache.