note 66186 added to function.ob-end-clean
| From: | ganderson at gpsinsight dot com | Date: | Tue, 16 May 2006 19:36:16 +0000 |
| Subject: | note 66186 added to function.ob-end-clean | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-111404@lists.php.net to get a copy of this message | ||
I am using output buffers to throw an exception during a database connect. Since the sybase_pconnect
function does not throw an exception:
// use output buffers to catch warnings on database connect
ob_start()
$this->dbh = sybase_pconnect($this->db_server,$this->db_user,$this->db_password);
if (ob_get_length()>0 || $this->dbh===false) {
throw new Database_LoginException("Could not login");
}
ob_end_clean();
After trying to connect, it tests to see if the output buffer was written to (a warning) then cleans
that and throws an exception.
----
Server IP: 216.194.113.175
Probable Submitter: 71.39.71.33
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.ob-end-clean.php
Edit -- http://master.php.net/note/edit/66186
Del: integrated -- http://master.php.net/note/delete/66186/integrated
Del: useless -- http://master.php.net/note/delete/66186/useless
Del: bad code -- http://master.php.net/note/delete/66186/bad+code
Del: spam -- http://master.php.net/note/delete/66186/spam
Del: non-english -- http://master.php.net/note/delete/66186/non-english
Del: in docs -- http://master.php.net/note/delete/66186/in+docs
Del: other reasons-- http://master.php.net/note/delete/66186
Reject -- http://master.php.net/note/reject/66186
Search -- http://master.php.net/manage/user-notes.php