|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-04-28 03:57 UTC] arnaud@php.net
[2003-05-04 12:26 UTC] lsmith@php.net
[2003-06-11 12:08 UTC] cox@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 21:00:02 2025 UTC |
It looks like when DB_common::getOne() or DB_common::getRow() is called, and no results are returned, the DB_Result object is never free()ed. With pgsql this means that the row and num_rows arrays never get cleared. I came across this when my PHP scripts died with out-of-memory exceptions. This doesn't yet seem to be fixed in CVS. I think the simple fix is to move the lines that free $res above the test of $err: --- common.php.orig 2003-04-06 11:08:53.000000000 -0400 +++ common.php 2003-04-06 11:08:34.000000000 -0400 @@ -700,16 +700,16 @@ } $err = $res->fetchInto($row, DB_FETCHMODE_ORDERED); - if ($err !== DB_OK) { - return $err; - } $res->free(); - if (isset($sth)) { $this->freeResult($sth); } + if ($err !== DB_OK) { + return $err; + } + return $row[0]; } @@ -764,15 +764,15 @@ $err = $res->fetchInto($row, $fetchmode); - if ($err !== DB_OK) { - return $err; - } $res->free(); - if (isset($sth)) { $this->freeResult($sth); } + if ($err !== DB_OK) { + return $err; + } + return $row; }