Table prefixes bug
gildedgod - December 22, 2008 - 11:51
| Project: | #translatable |
| Version: | 5.x-1.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | duplicate |
Jump to:
Description
file:translatable.database.inc
line: 179
code:
<?php
db_query("INSERT INTO {$table} (". implode(',', $fields['columns']) .") VALUES (". implode(',', $fields['types']) .")", $fields['values']);
?>I have drupal installed with table prefix "demo_" for all tables. Module raises error on new translation submit:
Table node_translatable doen't exists
It happens because according to PHP string variable behavior, after replacing "{$table}" by value of variable $table, PHP engine cleans tags "{" & "}", so, we need to apply this change in code for #translatable module to work with tables with prefixes:
<?php
db_query("INSERT INTO {".$table."} (". implode(',', $fields['columns']) .") VALUES (". implode(',', $fields['types']) .")", $fields['values']);
?>
#1
The same on 210 line too
- from:
<?phpreturn db_query("UPDATE {$table} SET ". implode(',', $fields['assigns']) ." WHERE ". $fields['where'], $fields['values']);
?>
- to:
<?phpreturn db_query("UPDATE {".$table."} SET ". implode(',', $fields['assigns']) ." WHERE ". $fields['where'], $fields['values']);
?>
#2
This was already fixed in #244276: doesn't seem to work with db table prefix. You might want to consider updating to the latest development snapshot.