You are here

function variablecheck_check_variables in Variable Check 6

Same name and namespace in other branches
  1. 7 variablecheck.module \variablecheck_check_variables()

Helper that returs a list of invalid variables and their values.

2 calls to variablecheck_check_variables()
variablecheck_check_variables_page in ./variablecheck.module
Helper that tries to display all variables that fail to unserialize, causing ugly Notices on production sites.
variablecheck_requirements in ./variablecheck.module
Implementation of hook_requirements()

File

./variablecheck.module, line 42

Code

function variablecheck_check_variables() {
  $rows = null;
  $result = db_query("SELECT name, value FROM {variable} ORDER BY name ASC");

  // Test each entry for validity.
  while ($entry = db_fetch_object($result)) {

    // Suppress the notice.
    $value = @unserialize($entry->value);

    // If the unserialize call returned FALSE and the stored value is NOT a
    // boolean false, list it in the report.
    if ($value === FALSE && $entry->value != serialize(FALSE)) {
      $row = array(
        $entry->name,
        $entry->value,
      );
      $rows[] = $row;
    }
  }
  return $rows;
}