diff --git a/src/Illuminate/Database/Connection.php b/src/Illuminate/Database/Connection.php index c6ca41d7b3ba..99f23d2f4f93 100755 --- a/src/Illuminate/Database/Connection.php +++ b/src/Illuminate/Database/Connection.php @@ -336,13 +336,15 @@ public function select($query, $bindings = [], $useReadPdo = true) $fetchMode = $me->getFetchMode(); $fetchArgument = $me->getFetchArgument(); + $fetchConstructorArgument = $me->getFetchConstructorArgument(); if ($fetchMode === PDO::FETCH_CLASS && ! isset($fetchArgument)) { $fetchArgument = 'StdClass'; + $fetchConstructorArgument = null; } return isset($fetchArgument) - ? $statement->fetchAll($fetchMode, $fetchArgument, $me->getFetchConstructorArgument()) + ? $statement->fetchAll($fetchMode, $fetchArgument, $fetchConstructorArgument) : $statement->fetchAll($fetchMode); }); } @@ -366,13 +368,15 @@ public function cursor($query, $bindings = [], $useReadPdo = true) $fetchMode = $me->getFetchMode(); $fetchArgument = $me->getFetchArgument(); + $fetchConstructorArgument = $me->getFetchConstructorArgument(); if ($fetchMode === PDO::FETCH_CLASS && ! isset($fetchArgument)) { $fetchArgument = 'StdClass'; + $fetchConstructorArgument = null; } if (isset($fetchArgument)) { - $statement->setFetchMode($fetchMode, $fetchArgument, $me->getFetchConstructorArgument()); + $statement->setFetchMode($fetchMode, $fetchArgument, $fetchConstructorArgument); } else { $statement->setFetchMode($fetchMode); }