Heine

  • drupal
  • drupal core commits
  • about
  • contact
Home

Commit 212700 by webchick

#464878 by chx: Fix SQLite abstraction layer to accept arrays of placeholder values without leading :, for compatibility with PDO.

--- includes/database/sqlite/database.inc       2009/04/20 20:02:30     1.15
+++ includes/database/sqlite/database.inc       2009/05/17 03:31:36     1.16
@@ -202,11 +202,20 @@
         // Else, this is using named placeholders.
         foreach ($args as $placeholder => $value) {
           if (is_numeric($value)) {
+            // We will remove this placeholder from the query and PDO throws an
+            // exception if the number of placeholders in the query and the
+            // arguments does not match.
+            unset($args[$placeholder]);
+            // PDO allows placeholders to not be prefixed by a colon. See
+            // <a href="http://marc.info/?l=php-internals&m=111234321827149&w=2" title="http://marc.info/?l=php-internals&m=111234321827149&w=2" rel="nofollow">http://marc.info/?l=php-internals&m=111234321827149&w=2</a> for
+            // more.
+            if ($placeholder[0] != ':') {
+              $placeholder = ":$placeholder";
+            }
             // When replacing the placeholders, make sure we search for the
             // exact placeholder. For example, if searching for
             // ':db_placeholder_1', do not replace ':db_placeholder_11'.
             $query = preg_replace('/' . preg_quote($placeholder) . '\b/', $value, $query);
-            unset($args[$placeholder]);
           }
         }
       }

No votes yet
  • Drupal Core
  • Download patch

Recent posts

  • Drupal 6: $base_path doesn't always point to the frontpage
  • XNA SoundEffect ContentLoadException
  • A new form element in Drupal core
  • The backstabbing March-Hare
  • Drupal HEAD and HTTP 500 errors on IIS 7

All-time popular content

  • Update UID 1 password via JS
  • Keeping an eye on Drupal core
  • Subversion on Strato V-PowerServer
  • A new form element in Drupal core
  • Access denied - Are you sure?
more

Tags

Captcha Coding Drupal FAPI IIS Let's hope it doesn't become popular Performance PHP Planet Drupal Quiz Security V-PowerServer
more tags
  • drupal
  • drupal core commits
  • about
  • contact

Copyright © 2009 by Heine Deelstra. All rights reserved.