When trying to export variables that have a colon (":") in their names, like panelizer_node:article_allowed_layouts, using db_query() throws an exception due to confusion with PDO placeholders which also use ":".
Replacing
$result = db_query("SELECT * FROM {variable} WHERE name IN (:names)", array(':names' => $data));
with
$result = db_select('variable', 'v')
->fields('v', array('name', 'value'))
->condition('name', $data, 'IN')
->execute();
solves the problem.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 1350346-2-strongarm-names-with-colon_drush-make.patch | 754 bytes | patcon |
| strongarm-names-with-colon.patch | 762 bytes | floretan |
Comments
Comment #1
skwashd commentedI didn't test this with a colon in the variable name. From previous experience it will solve the bug identified above.
I tested this patch with variables with upper case characters in the name, such as pathauto config when using language specific path patterns. It fixes this problem too.
As this patch solves 2 bugs it should be committed.
Comment #2
patcon commentedRerolled patch to work against beta4 with drush make (ie. -p0)
Yippee-ki-yoh-kay-yay
Comment #3
univate commentedAlso confirming the occurrence of this bug and have reviewed the patch and agree its good.
Comment #4
febbraro commentedCommitted to 7.x, thanks.
http://drupalcode.org/project/strongarm.git/commit/286647d
Needed for 6.x?
Comment #5
skwashd commentedThis doesn't need a backport to D6 as PDO was only introduced in D7. Using 6.x-2.1 I was able to export a variable called strongarm:test without any problems.
Comment #6
febbraro commentedThanks for verifying.