0

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?

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

1 Answer 1

1

I ran into this as well. I think it's similar to the issue in this PR: https://github.com/civicrm/civicrm-core/pull/25728

But that one addressed the issue in D8, whereas the issue persists in D7.

1
  • we fixed this by making sure our standalone script called drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL) early in the script. that ensured watchdog was available. Commented Sep 25 at 12:51

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.