Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Preventing memory leak in PDO when retrieving results from the driver…

…, fixes #2293
  • Loading branch information...
commit 2bffd4c26dabbe3d77ac1a92e656b249785c1024 1 parent 5180540
@lorenzo lorenzo authored
View
2  lib/Cake/Model/Datasource/Database/Mysql.php
@@ -238,7 +238,7 @@ public function resultSet($results) {
* @return mixed array with results fetched and mapped to column names or false if there is no results left to fetch
*/
public function fetchResult() {
- if ($row = $this->_result->fetch()) {
+ if ($row = $this->_result->fetch(PDO::FETCH_NUM)) {
$resultRow = array();
foreach ($this->map as $col => $meta) {
list($table, $column, $type) = $meta;
View
2  lib/Cake/Model/Datasource/Database/Postgres.php
@@ -707,7 +707,7 @@ public function resultSet(&$results) {
* @return array
*/
public function fetchResult() {
- if ($row = $this->_result->fetch()) {
+ if ($row = $this->_result->fetch(PDO::FETCH_NUM)) {
$resultRow = array();
foreach ($this->map as $index => $meta) {
View
2  lib/Cake/Model/Datasource/Database/Sqlite.php
@@ -330,7 +330,7 @@ public function resultSet($results) {
* @return mixed array with results fetched and mapped to column names or false if there is no results left to fetch
*/
public function fetchResult() {
- if ($row = $this->_result->fetch()) {
+ if ($row = $this->_result->fetch(PDO::FETCH_NUM)) {
$resultRow = array();
foreach ($this->map as $col => $meta) {
list($table, $column, $type) = $meta;
View
2  lib/Cake/Model/Datasource/Database/Sqlserver.php
@@ -607,7 +607,7 @@ public function read(Model $model, $queryData = array(), $recursive = null) {
* @return mixed
*/
public function fetchResult() {
- if ($row = $this->_result->fetch()) {
+ if ($row = $this->_result->fetch(PDO::FETCH_NUM)) {
$resultRow = array();
foreach ($this->map as $col => $meta) {
list($table, $column, $type) = $meta;
Please sign in to comment.
Something went wrong with that request. Please try again.