Re: cvs: pear /DB package.xml /DB/DB common.php

From: Date: Wed, 28 Apr 2004 20:12:57 +0000
Subject: Re: cvs: pear /DB package.xml /DB/DB common.php
References: 1  Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-18906@lists.php.net to get a copy of this message
Daniel Convissor wrote:
danielc Wed Apr 28 15:58:29 2004 EDT
  Modified files:                  /pear/DB	package.xml     /pear/DB/DB	common.php   Log:
Fix notice caused by passing invalid $col to getCol(). http://cvs.php.net/diff.php/pear/DB/package.xml?r1=1.97&r2=1.98&ty=u Index: pear/DB/package.xml diff -u pear/DB/package.xml:1.97 pear/DB/package.xml:1.98 --- pear/DB/package.xml:1.97 Wed Apr 28 14:38:06 2004 +++ pear/DB/package.xml Wed Apr 28 15:58:29 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> <package version="1.0"> - <!-- $Id: package.xml,v 1.97 2004/04/28 18:38:06 danielc Exp $ --> + <!-- $Id: package.xml,v 1.98 2004/04/28 19:58:29 danielc Exp $ --> <name>DB</name> <summary>Database Abstraction Layer</summary> <description> @@ -72,6 +72,10 @@ Fix docblocks for getAssoc() and limitQuery(). (danielc) +- common: +Fix notice caused by passing invalid $col to +getCol(). (danielc) + - mysqli: Move connection id to first argument in mysqli_*() functions. (danielc) http://cvs.php.net/diff.php/pear/DB/DB/common.php?r1=1.100&r2=1.101&ty=u Index: pear/DB/DB/common.php diff -u pear/DB/DB/common.php:1.100 pear/DB/DB/common.php:1.101 --- pear/DB/DB/common.php:1.100 Wed Apr 28 14:38:07 2004 +++ pear/DB/DB/common.php Wed Apr 28 15:58:29 2004 @@ -18,7 +18,7 @@
 // | Maintainer: Daniel Convissor <danielc@php.net>                       |
// +----------------------------------------------------------------------+ // -// $Id: common.php,v 1.100 2004/04/28 18:38:07 danielc Exp $ +// $Id: common.php,v 1.101 2004/04/28 19:58:29 danielc Exp $ require_once 'PEAR.php'; @@ -27,7 +27,7 @@ * inherited by all such * * @package DB - * @version $Id: common.php,v 1.100 2004/04/28 18:38:07 danielc Exp $ + * @version $Id: common.php,v 1.101 2004/04/28 19:58:29 danielc Exp $ * @category Database * @author Stig Bakken <ssb@php.net> * @author Tomas V.V.Cox <cox@idecnet.com> @@ -1342,10 +1342,16 @@
+        if (!is_array($row = $res->fetchRow($fetchmode)) ||
+            !array_key_exists($col, $row))
+        {
+            $ret =& $this->raiseError(DB_ERROR_TRUNCATED);
+        } else {
+            $ret = array($row[$col]);
+            while (is_array($row = $res->fetchRow($fetchmode))) {
+                $ret[] = $row[$col];
+            }
ups ... sorry for not mentioning this fix to you. i had the same bug in MDB. one minor thingi which you may want to do is move to a do/while loop .. that way you can get rid of the "$ret = array($row[$col]);" probably not worth the effort though. anyways in the future I will better myself in regards to checking of MDB bugs also affect DB. regards, Lukas Smith smith@backendmedia.com _______________________________ BackendMedia www.backendmedia.com berlin@backendmedia.com Linn Zwoch Smith GbR Pariser Str. 44 D-10707 Berlin Tel +49 30 83 22 50 00 Fax +49 30 83 22 50 07

« previous php.pear.cvs (#18906) next »