After updating a CiviCRM with Drupal 7 system with the CiviCRM Security Update a PHP script that I wrote throws the following error:

PHP Fatal error:  Uncaught Error: Call to undefined function watchdog() in xxxxxxx/public/sites/all/modules/civicrm/CRM/Utils/System/DrupalBase.php:274
Stack trace:
#0 xxxxxxx/sites/all/modules/civicrm/CRM/Core/Error.php(607): CRM_Utils_System_DrupalBase->logger('Contribution 28...', 6)
#1 xxxxxxx/sites/all/modules/civicrm/CRM/Core/Error/Log.php(69): CRM_Core_Error::debug_log_message('Contribution 28...', false, '', 6)
#2 xxxxxxx/sites/all/modules/civicrm/vendor/psr/log/Psr/Log/AbstractLogger.php(113): CRM_Core_Error_Log->log('info', 'Contribution 28...', Array)
#3 xxxxxxx/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(3880): Psr\Log\AbstractLogger->info('Contribution 28...')
#4 xxxxxxx/sites/all/modules/civicrm/api/v3/Contributio in xxxxxxx/sites/all/modules/civicrm/CRM/Utils/System/DrupalBase.php on line 274

After disabling "Drupal Watchdog Logging" in the GUI (Administration > Debugging and Error handling) the error disappears. This is not really an option though, as we want to keep the Drupal Error Logging for the system.

The script is creating payments via CiviCRM APIv3 based on bank reports. The error seems pretty "basic" though, and not related much to the script's functions. The script is run daily by a cronjob.

I updated CiviCRM again to 5.65.1 but this didn't fix the problem.

Anybody has a hint what could be wrong here?

  • What tool are you using to run the script?
    – Demerit
    Sep 25, 2023 at 15:50
  • It's a PHP script that is run daily by a cronjob. I edited my question
    – emma
    Sep 27, 2023 at 11:42


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.