Drupal's error reporting reports warnings when the code is prefixed with @ to suppress warnings. A single line added to the error_handler in common.inc fixes this.

/**
 * Log errors as defined by administrator
 * Error levels:
 *  0 = Log errors to database.
 *  1 = Log errors to database and to screen.
 */
function error_handler($errno, $message, $filename, $line) {
  if (error_reporting() == 0) return; // Ignore warning if prefixed with @

  if ($errno & (E_ALL ^ E_NOTICE)) {
    $types = array(1 => 'error', 2 => 'warning', 4 => 'parse error', 8 => 'notice', 16 => 'core error', 32 => 'core warning', 64 => 'compile error', 128 => 'compile warning', 256 => 'user error', 512 => 'user warning', 1024 => 'user notice', 2048 => 'strict warning');
    $entry = $types[$errno] .': '. $message .' in '. $filename .' on line '. $line .'.';

    // Note: force display of error messages in update.php
    if (variable_get('error_level', 1) == 1 || strstr($_SERVER['PHP_SELF'], 'update.php')) {
      drupal_set_message($entry, 'error');
    }

    watchdog('php', t('%message in %file on line %line.', array('%error' => $types[$errno], '%message' => $message, '%file' => $filename, '%line' => $line)), WATCHDOG_ERROR);
  }
}

Comments

Steven’s picture

Note: this has already been fixed in HEAD with:

  // If the @ error suppression operator was used, error_reporting is temporarily set to 0
  if (error_reporting() == 0) {
    return;
  }
ricabrantes’s picture

@Steven this is fixed??

pasqualle’s picture

Status: Active » Fixed

This version is not supported. Reopen or create a new issue if the problem exists in any recent version (version equal or above Drupal 5)

pasqualle’s picture

Status: Fixed » Closed (fixed)