From 1ec9a7b7a6ae3801e7cd0147519aa04be992ad8a Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 19 Sep 2008 08:18:35 +0000 Subject: - Patch #298309 by mfer: add PDO::FETCH_PROPS_LATE to tell __construct() to run before properties are added to the object. This is closer to the expected behavior and avoids that values are being overwritten. --- includes/database/database.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'includes/database/database.inc') diff --git a/includes/database/database.inc b/includes/database/database.inc index ed479fe5a..0369b34b0 100644 --- a/includes/database/database.inc +++ b/includes/database/database.inc @@ -1007,7 +1007,8 @@ class DatabaseStatement extends PDOStatement { public function execute($args, $options) { if (isset($options['fetch'])) { if (is_string($options['fetch'])) { - $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']); -- cgit v1.2.3