The variable $message_one is declared as static which means it retains its value on function re-entry. If "allow_url_fopen" is off, function _janode_check_404() works correctly on the first iteration, with early exit, but it sets $message_once to false. Each additional url will be tested, and will fail because the early exit is not available.

function _janode_check_404($janode) {
  static $message_once = TRUE;

  // check php var "allow_url_fopen" is true as we need it to fetch the URL
  if (!ini_get('allow_url_fopen')) {
    if ($message_once) {
      watchdog('cron', 'PHP INI "allow_url_fopen" is false', WATCHDOG_NOTICE);
      $message_once = FALSE;
      return;
    }
  }

To fix, the return statement should be moved:

function _janode_check_404($janode) {
  static $message_once = TRUE;

  // check php var "allow_url_fopen" is true as we need it to fetch the URL
  if (!ini_get('allow_url_fopen')) {
    if ($message_once) {
      watchdog('cron', 'PHP INI "allow_url_fopen" is false', WATCHDOG_NOTICE);
      $message_once = FALSE;
    }
    return;
  }

Comments

AjK’s picture

Status: Active » Fixed

Fixed, thanks. Expect release DRUPAL-5--1-3 soon that includes this fix.

for reference, commit that fixes issue: http://drupal.org/cvs?commit=128408

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.