From eb4759d90bfb161adf73205e4c179878511646b5 Mon Sep 17 00:00:00 2001 From: Dries Date: Fri, 22 Mar 2013 13:15:31 -0400 Subject: [PATCH] =?UTF-8?q?Issue=20#1854752=20by=20G=C3=A1bor=20Hojtsy,=20?= =?UTF-8?q?chx,=20amateescu:=20re-Add=20PDO::FETCH=5FPROPS=5FLATE=20to=20P?= =?UTF-8?q?DO::FETCH=5FCLASS.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Drupal/Core/Database/Statement.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/lib/Drupal/Core/Database/Statement.php b/core/lib/Drupal/Core/Database/Statement.php index 120fac6c1c7..b7c9fddea9d 100644 --- a/core/lib/Drupal/Core/Database/Statement.php +++ b/core/lib/Drupal/Core/Database/Statement.php @@ -40,10 +40,9 @@ class Statement extends PDOStatement implements StatementInterface { public function execute($args = array(), $options = array()) { if (isset($options['fetch'])) { if (is_string($options['fetch'])) { - // Default to an object. Note: db fields will be added to the object - // before the constructor is run. If you need to assign fields after - // the constructor is run, see http://drupal.org/node/315092. - $this->setFetchMode(PDO::FETCH_CLASS, $options['fetch']); + // PDO::FETCH_PROPS_LATE tells __construct() to run before properties + // are added to the object. + $this->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, $options['fetch']); } else { $this->setFetchMode($options['fetch']);