I have no idea what is going on so I'll spew as much info as I can think of...

Enabling the Glossary module and adding the "Search for Glossary Terms" block (to the footer or rightsidebar) in Drupal 6.1, Php version 5.2.5 and mySQLi version 5.0.45 on Apache/2.2.4 generates the following warning on every page:

warning: preg_match() expects parameter 2 to be string, array given in
/..../includes/bootstrap.inc on line 718.

bootstrap.inc     lines 714-719

function drupal_validate_utf8($text) {
  if (strlen($text) == 0) {
    return TRUE;
  }
  return (preg_match('/^./us', $text) == 1);
}

I had just installed Drupal 6.1 from scracth this morning and added these modules
    Glossary 6.x-1.0-beta3 (Taxonomy (enabled));
    Printer-friendly pages 6.x-1.x-dev;
    Printer-friendly pages as PDF 6.x-1.x-dev (disabled);
    Site Documentation 6.x-1.0-beta1;
    Taxonomy Image 6.x-1.0-beta1
Thought that maybe the problem was that I hadn't created any Taxonomy content so added 2 vocabularies with 1 term each via Home » Administer » Content management > Taxonomy. There was no change.

If I try searching one of the terms, the following warning appears:

  • warning: array_fill() [function.array-fill]: Number of elements must be positive in /..../includes/database.inc on line 235.
  • warning: implode() [function.implode]: Invalid arguments passed in /..../includes/database.inc on line 235.
  • user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND (description LIKE '%%' OR name LIKE '%%')' at line 1 query: SELECT tid FROM term_data WHERE vid IN () AND (description LIKE '%%' OR name LIKE '%%') in /..../modules/glossary/glossary.module on line 215.
  • warning: array_fill() [function.array-fill]: Number of elements must be positive in /..../includes/database.inc on line 235.
  • warning: implode() [function.implode]: Invalid arguments passed in /..../includes/database.inc on line 235.
  • user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND (description LIKE '%%' OR name LIKE '%%')' at line 1 query: SELECT tid FROM term_data WHERE vid IN () AND (description LIKE '%%' OR name LIKE '%%') in /..../modules/glossary/glossary.module on line 215.
  • warning: preg_match() expects parameter 2 to be string, array given in /..../includes/bootstrap.inc on line 718.

Here's those referenced lines:
includes/database.inc     lines 233-236

function db_placeholders($arguments, $type = 'int') {
  $placeholder = db_type_placeholder($type);
  return implode(',', array_fill(0, count($arguments), $placeholder));
}

modules/glossary/glossary.module     lines 210-221

function glossary_search_results($keys = null) {
  $vids = _glossary_get_filter_vids();
  $output = '';
 
  $sql = "SELECT tid FROM {term_data} WHERE vid IN (". db_placeholders($vids) .") AND (description LIKE '%%%s%%' OR name LIKE '%%%s%%')";
  $result = db_query($sql, $vids, $keys, $keys);
  while ($row = db_fetch_object($result)) {
    $term = taxonomy_get_term($row->tid);
    $output .= theme('glossary_overview_item', $term, true);
  }
  return $output;
}

Comments

nancydru’s picture

http://drupal.org/node/225211

I am aware of this problem, and have it fixed on my test site. Unfortunately, the search query is still not functioning correctly. I am still trying to track down why, but I have a feeling that it is a core issue.

nancydru’s picture

Assigned: Unassigned » nancydru
Status: Active » Postponed (maintainer needs more info)

See http://drupal.org/node/229447. So it turns out that it was an issue caused by a core change, but not core itself.

nancydru’s picture

Status: Postponed (maintainer needs more info) » Fixed

Fix committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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