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

From: Date: Wed, 28 Apr 2004 19:58:29 +0000
Subject: cvs: pear /DB package.xml /DB/DB common.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-18900@lists.php.net to get a copy of this message
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 @@ } $fetchmode = is_int($col) ? DB_FETCHMODE_ORDERED : DB_FETCHMODE_ASSOC; - $ret = array(); - while (is_array($row = $res->fetchRow($fetchmode))) { - $ret[] = $row[$col]; + 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]; + } } $res->free();

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