cvs: pear /DB package.xml /DB/DB dbase.php pgsql.php

From: Date: Tue, 03 Aug 2004 01:46:17 +0000
Subject: cvs: pear /DB package.xml /DB/DB dbase.php pgsql.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-22498@lists.php.net to get a copy of this message
danielc Mon Aug 2 21:46:17 2004 EDT Modified files: /pear/DB package.xml /pear/DB/DB dbase.php pgsql.php Log: * Use track_errors instead of output buffering. Bug 2011. http://cvs.php.net/diff.php/pear/DB/package.xml?r1=1.114&r2=1.115&ty=u Index: pear/DB/package.xml diff -u pear/DB/package.xml:1.114 pear/DB/package.xml:1.115 --- pear/DB/package.xml:1.114 Tue Jul 20 09:16:44 2004 +++ pear/DB/package.xml Mon Aug 2 21:46:17 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> <package version="1.0"> - <!-- $Id: package.xml,v 1.114 2004/07/20 13:16:44 danielc Exp $ --> + <!-- $Id: package.xml,v 1.115 2004/08/03 01:46:17 danielc Exp $ --> <name>DB</name> <summary>Database Abstraction Layer</summary> <description> @@ -64,6 +64,9 @@ * pgsql: Add port to connect string when protocol is unix. Bug 1919. (danielc) + +Use track_errors instead of output buffering to capture +error messages when connecting. Bug 2011. (danielc) ]]></notes> <filelist> <file role="php" baseinstalldir="/">DB.php</file> http://cvs.php.net/diff.php/pear/DB/DB/dbase.php?r1=1.20&r2=1.21&ty=u Index: pear/DB/DB/dbase.php diff -u pear/DB/DB/dbase.php:1.20 pear/DB/DB/dbase.php:1.21 --- pear/DB/DB/dbase.php:1.20 Thu Jun 24 11:24:56 2004 +++ pear/DB/DB/dbase.php Mon Aug 2 21:46:17 2004 @@ -17,7 +17,7 @@ // | Maintainer: Daniel Convissor <danielc@php.net> | // +----------------------------------------------------------------------+ // -// $Id: dbase.php,v 1.20 2004/06/24 15:24:56 danielc Exp $ +// $Id: dbase.php,v 1.21 2004/08/03 01:46:17 danielc Exp $ // XXX legend: @@ -31,7 +31,7 @@ * extension. * * @package DB - * @version $Id: dbase.php,v 1.20 2004/06/24 15:24:56 danielc Exp $ + * @version $Id: dbase.php,v 1.21 2004/08/03 01:46:17 danielc Exp $ * @category Database * @author Stig Bakken <ssb@php.net> */ @@ -77,13 +77,18 @@ return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); } $this->dsn = $dsninfo; - ob_start(); - $conn = @dbase_open($dsninfo['database'], 0); - $error = ob_get_contents(); - ob_end_clean(); + + $ini = ini_get('track_errors'); + if ($ini) { + $conn = @dbase_open($dsninfo['database'], 0); + } else { + ini_set('track_errors', 1); + $conn = @dbase_open($dsninfo['database'], 0); + ini_set('track_errors', $ini); + } if (!$conn) { return $this->raiseError(DB_ERROR_CONNECT_FAILED, null, - null, null, strip_tags($error)); + null, null, strip_tags($php_errormsg)); } $this->connection = $conn; return DB_OK; http://cvs.php.net/diff.php/pear/DB/DB/pgsql.php?r1=1.78&r2=1.79&ty=u Index: pear/DB/DB/pgsql.php diff -u pear/DB/DB/pgsql.php:1.78 pear/DB/DB/pgsql.php:1.79 --- pear/DB/DB/pgsql.php:1.78 Tue Jul 20 09:16:44 2004 +++ pear/DB/DB/pgsql.php Mon Aug 2 21:46:17 2004 @@ -18,7 +18,7 @@ // | Maintainer: Daniel Convissor <danielc@php.net> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.78 2004/07/20 13:16:44 danielc Exp $ +// $Id: pgsql.php,v 1.79 2004/08/03 01:46:17 danielc Exp $ require_once 'DB/common.php'; @@ -27,7 +27,7 @@ * extension. * * @package DB - * @version $Id: pgsql.php,v 1.78 2004/07/20 13:16:44 danielc Exp $ + * @version $Id: pgsql.php,v 1.79 2004/08/03 01:46:17 danielc Exp $ * @category Database * @author Rui Hirokawa <hirokawa@php.net> * @author Stig Bakken <ssb@php.net> @@ -122,14 +122,18 @@ } $connect_function = $persistent ? 'pg_pconnect' : 'pg_connect'; - // catch error - ob_start(); - $conn = $connect_function($connstr); - $error = ob_get_contents(); - ob_end_clean(); + + $ini = ini_get('track_errors'); + if ($ini) { + $conn = @$connect_function($connstr); + } else { + ini_set('track_errors', 1); + $conn = @$connect_function($connstr); + ini_set('track_errors', $ini); + } if ($conn == false) { return $this->raiseError(DB_ERROR_CONNECT_FAILED, null, - null, null, strip_tags($error)); + null, null, strip_tags($php_errormsg)); } $this->connection = $conn; return DB_OK;

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