Dolibarr / dolibarr

Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). it's an open source Web application (written in PHP) designed for businesses of any sizes, foundations and freelancers.
https://www.dolibarr.org
GNU General Public License v3.0
5.46k stars 2.79k forks source link

error 500 using rest API explorer ../api/index.php/explorer/ (or API Swagger description url) #27471

Open gentooza opened 10 months ago

gentooza commented 10 months ago

Bug

go to URL as provided by REST api module: ../api/index.php/explorer/ or ../api/index.php/explorer/swagger.json?DOLAPIKEY=youruserapikey

result in error 500.

PHP log:

mod_fcgid: stderr: PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function User::__construct(), 0 passed and exactly 1 expected in /var/www/clients/client15/web133/web/dolibarr/htdocs/user/class/user.class.php:385
mod_fcgid: stderr: Stack trace:
mod_fcgid: stderr: #0 [internal function]: User->__construct()
mod_fcgid: stderr: #1 /var/www/clients/client15/web133/web/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Routes.php(668): ReflectionClass->newInstance()
mod_fcgid: stderr: #2 /var/www/clients/client15/web133/web/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Routes.php(168): Luracast\\Restler\\Routes::getTypeAndModel()
mod_fcgid: stderr: #3 /var/www/clients/client15/web133/web/dolibarr/htdocs/includes/restler/framework/Luracast/Restler/Restler.php(1375): Luracast\\Restler\\Routes::addAPIClass()
mod_fcgid: stderr: #4 /var/www/clients/client15/web133/web/dolibarr/htdocs/api/index.php(291): Luracast\\Restler\\Restler->addAPIClass()
mod_fcgid: stderr: #5 {main}
mod_fcgid: stderr:   thrown in /var/www/clients/client15/web133/web/dolibarr/htdocs/user/class/user.class.php on line 385

Environment Version

16.0.5

Environment OS

Debian 9

Environment Web server

Apache

Environment PHP

~8.0~ 7.4

Environment Database

MariaDB

Environment URL(s)

No response

Expected and actual behavior

It's first time using REST api in dolibarr, I don't know, I guess to can explore the API methods :-D

Steps to reproduce the behavior

installing 16.0.5 in debian 9, apache2, php 8.0, mariaDB, installing REST api module and try it I guess.

Attached files

No response

ksar-ksar commented 10 months ago

Hello,

Dolibarr V16 is not compatible PHP V8. Please downgrade your PHP version to V7.4 or upgrade your Dolibarr to V18.

gentooza commented 10 months ago

Hi @ksar-ksar ! And thanks for the response! In fact I already tried to change the PHP versión with no luck. Dolibarr throws the same error using PHP 7.4

gentooza commented 9 months ago

Hi!

So... What?

cheers

ksar-ksar commented 9 months ago

Hello,

Work for me on V16.0.5 and PHP V7 Are you sure that all the PHP files are the one of dolibarr V16 ?

gentooza commented 9 months ago

Hi @ksar-ksar

I'm going to compare using diff every file involved in the traceback, between our installation and a vanilla 16.0.5 source code. Is it all right?

Thanks!

gentooza commented 9 months ago

Hi @ksar-ksar

I've just removed the htdocs folder and copy it back from a fresh new install of 16.0.5 and the same error persists :-(

What could I test or change?

thanks!