dolibarr icon indicating copy to clipboard operation
dolibarr copied to clipboard

Cron error with Conf::$api on v17.0.2

Open m-hefti opened this issue 1 year ago • 1 comments

Hi,

I upgraded from v15 to v17.0.2 and experience an issue with Cron jobs. I'm getting this error:

PHP Warning: Undefined property: Conf::$api in /[.../dolibarr]/core/class/utils.class.php (http://[domain.ext/dolibarr]/core/class/utils.class.php) on line 149 PHP Warning: Attempt to read property "dir_temp" on null in /[.../dolibarr]/core/class/utils.class.php (http://[domain.ext/dolibarr]/core/class/utils.class.php) on line 149

It seems that $conf->api is not always set, which is not checked when called through the cron_run_jobs.php file. I'm guessing it's the job trying to remove temp files that triggers this error.

I have found a reference that explicitly sets $conf->[...module...]->dir_temp in the source code (core/class/conf.class.php, line 442), but didn't really figure out how to start debugging as I'm not a Dolibarr expert... any fix (or help) would be appreciated.

Thank you!

Environment Version

Dolibarr 17.0.2

Environment OS

FreeBSD 12.4

Environment Web server

Apache

Environment PHP

PHP 8.1.17

Environment Database

MySQL or MariaDB 10.6.12

Environment URL(s)

No response

Expected and actual behavior

Cron job should remove temporary files without error

Steps to reproduce the behavior

Run cron_run_jobs.php, with the default Dolibarr "purgeFiles tempfilesold+logfiles" job programmed

Attached files

No response

m-hefti avatar Jun 04 '23 16:06 m-hefti

Same error on Dolibarr 19.0.1., PHP 8.1.2 (Ubuntu), nginx 1.18.0, MariaDB 5.5.5-10.6.16-MariaDB-0ubuntu0.22.04.1-log PHP Warning: Undefined property: Conf::$api in /var/www/dolibarr/htdocs/core/class/utils.class.php on line 158 PHP Warning: Attempt to read property "dir_temp" on null in /var/www/dolibarr/htdocs/core/class/utils.class.php on line 158

borsti67 avatar May 06 '24 07:05 borsti67

still happens on 19.0.2 - do we have to create a new issue because the title reads v17? This ticket is open for a year by now without even a response... :(

borsti67 avatar Jun 03 '24 12:06 borsti67

I didn't get any answer neither. The problem remains, even if cronjob is run successfully (the bills are created). I just get an e-mail everytime it runs... a bit annoying but my clients are nevertheless able to work as expected.

I would still appreciate any fix.

m-hefti avatar Jun 03 '24 13:06 m-hefti

Same with 19.0.2

PHP Warning:  Undefined property: Conf::$api in /home/[domaine.tld/htdocs/core/class/utils.class.php](http://domaine.tld/htdocs/core/class/utils.class.php) on line 158
PHP Warning:  Attempt to read property "dir_temp" on null in /home/[domaine.tld/htdocs/core/class/utils.class.php](http://domaine.tld/htdocs/core/class/utils.class.php) on line 158

jpyrat avatar Aug 09 '24 09:08 jpyrat