Code review (profile)

  • : Function ereg() is deprecated in /opt/home/drupalcode/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /opt/home/drupalcode/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /opt/home/drupalcode/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /opt/home/drupalcode/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /opt/home/drupalcode/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /opt/home/drupalcode/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /opt/home/drupalcode/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /opt/home/drupalcode/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /opt/home/drupalcode/public_html/includes/file.inc on line 649.
  • : Function ereg() is deprecated in /opt/home/drupalcode/public_html/includes/file.inc on line 649.
Coder found 1 projects, 2 files
Coder provides helpful hints without false positives, but offers no guarantee for creating good code. You are the final arbitrar. If in doubt, read the Drupal documentation (see review links below and api.drupal.org).
Use the Selection Form to select options for this code review, or change the Default Settings and use the Default tab above.
modules/profile/profile.module

profile.module

  • severity: normalLine 452: Use ANSI standard <> instead of !=
        $result = db_query('SELECT name, title, type, weight, page FROM {profile_fields} WHERE fid != %d AND visibility = %d ORDER BY weight', $field->fid, PROFILE_PUBLIC_LISTINGS);
  • severity: normalLine 478: Use ANSI standard <> instead of !=
        $result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_values} v ON u.uid = v.uid WHERE v.fid = %d AND $query AND u.access != 0 AND u.status != 0 ORDER BY u.access DESC", 20, 0, NULL, $arguments);
  • severity: criticalclick to read moreLine 478: In SQL strings, Use db_query() placeholders in place of variables. This is a protential source of SQL injection attacks when the variable can come from user data. (Drupal Docs)
        $result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_values} v ON u.uid = v.uid WHERE v.fid = %d AND $query AND u.access != 0 AND u.status != 0 ORDER BY u.access DESC", 20, 0, NULL, $arguments);
    Explanation: Use %s and %d variable substitution. When inserting an array of values use $placeholders = implode(',', array_fill(0, count($args), "'%s'"));
  • severity: normalLine 511: Use ANSI standard <> instead of !=
        $result = pager_query('SELECT uid, access FROM {users} WHERE uid > 0 AND status != 0 AND access != 0 ORDER BY access DESC', 20, 0, NULL);
  • severity: normalLine 600: Use ANSI standard <> instead of !=
        $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d ORDER BY category, weight', PROFILE_HIDDEN);
  • severity: normalLine 603: Use ANSI standard <> instead of !=
        $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d AND visibility != %d ORDER BY category, weight', PROFILE_PRIVATE, PROFILE_HIDDEN);