pgsql

From: Damien Tournoud <damien@tournoud.net>


---

 includes/bootstrap.inc |    4 +++-
 includes/common.inc    |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)


diff --git includes/bootstrap.inc includes/bootstrap.inc
index 996dda3..c02a0f3 100644
--- includes/bootstrap.inc
+++ includes/bootstrap.inc
@@ -1368,7 +1368,9 @@ function drupal_get_schema($table = NULL, $rebuild = FALSE) {
         drupal_alter('schema', $schema);
       }
 
-      if (drupal_get_bootstrap_phase() == DRUPAL_BOOTSTRAP_FULL) {
+      // If the schema is empty, avoid saving it: some database engines require
+      // the schema to perform queries, and this could lead to infinite loops.
+      if (!empty($schema) && (drupal_get_bootstrap_phase() == DRUPAL_BOOTSTRAP_FULL)) {
         cache_set('schema', $schema);
       }
     }
diff --git includes/common.inc includes/common.inc
index cd4966a..9318598 100644
--- includes/common.inc
+++ includes/common.inc
@@ -947,7 +947,7 @@ function t($string, $args = array(), $langcode = NULL) {
   static $custom_strings;
 
   if (!isset($langcode)) {
-    $langcode = $language->language;
+    $langcode = isset($language->language) ? $language->language : 'en';
   }
 
   // First, check for an array of customized strings. If present, use the array
