int stripos ( string $haystack , string $needle [, int $offset = 0 ] )

function variable_del($name) {
global $conf, $db_prefix;

db_query("DELETE FROM {variable} WHERE name = '%s'", $name);

unset($conf[$name]);

// The write-through rebuild optimization isn't compatible with SimpleTest.
if (strpos($db_prefix, 'simpletest') === 0) {
cache_clear_all('variables', 'cache');
}

variable_cache_rebuild();
}

CommentFileSizeAuthor
#1 bootstrap_inc.patch550 bytestimhilliard

Comments

timhilliard’s picture

Status: Active » Needs review
StatusFileSize
new550 bytes

Hi there, I am getting the same warning as I have an array set as well for my $db_prefix variable. I have added a patch that should hopefully be the correct way to fix this.

The patch changes the test to this instead

function variable_del($name) {
  global $conf, $db_prefix;

  db_query("DELETE FROM {variable} WHERE name = '%s'", $name);

  unset($conf[$name]);

  // The write-through rebuild optimization isn't compatible with SimpleTest.
  if ((is_string($db_prefix) && strpos($db_prefix, 'simpletest') === 0) || (isset($db_prefix['default']) && strpos($db_prefix['default'], 'simpletest') === 0)) {
    cache_clear_all('variables', 'cache');
  }
  
  variable_cache_rebuild();
}

Cheers,
Tim

damien tournoud’s picture

Status: Needs review » Closed (won't fix)

Not a core issue. You are probably using Pressflow, please report this issue there.

timhilliard’s picture

Damien you're totally correct, sorry about that.