Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33228 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49567 invoked by uid 1010); 18 Nov 2007 00:38:53 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 49550 invoked from network); 18 Nov 2007 00:38:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Nov 2007 00:38:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=evertpot@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=evertpot@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.166.181 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: evertpot@gmail.com X-Host-Fingerprint: 64.233.166.181 py-out-1112.google.com Received: from [64.233.166.181] ([64.233.166.181:15248] helo=py-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/64-14070-C998F374 for ; Sat, 17 Nov 2007 19:38:52 -0500 Received: by py-out-1112.google.com with SMTP id d32so9324386pye for ; Sat, 17 Nov 2007 16:38:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=UcvMbc4ppiriMRw2BRrtVj9AjKAFGfXFr4VcdBVziwM=; b=N52klMyQqyu3MP4jk3BlXc28RUtMA2QgAfhpRrn7Dzfgp1w4frD9z9RiBBbCWxXSLDYItmhTB+3e9bYQ7R4BQn0EWhdkXLK4XAtXPUA/O2jyzqhInHdVt2N/8M6spiq3FtPw3Ex1ne/LmFU+HRzd1NmpVWnpwJKTxrx14iuyFRg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=K+yHzN/DnGZdCfQ+n7P8084OizzW7Xah6yRMII1k59Xb9mBGri1nu3uTYPiQls8FTAh45l9w4b/17c9q+DtiIiIEgKCEtzX+8vfPjb/0ZAu1t77S3cAaqpTq8Up5UHLuWhWybvgahz/G2duCpn81Vf48jLI4rpOxwMCd9QFur74= Received: by 10.65.239.14 with SMTP id q14mr7813112qbr.1195346329639; Sat, 17 Nov 2007 16:38:49 -0800 (PST) Received: from evertbook.local ( [99.231.26.44]) by mx.google.com with ESMTPS id f16sm3018508qba.2007.11.17.16.38.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 17 Nov 2007 16:38:48 -0800 (PST) Message-ID: <473F8996.9010807@rooftopsolutions.nl> Date: Sat, 17 Nov 2007 19:38:46 -0500 User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Mehmet Yavuz Selim Soyturk CC: internals@lists.php.net References: <1abd9eb20711171436w4b797bffu4cab758407beebf6@mail.gmail.com> In-Reply-To: <1abd9eb20711171436w4b797bffu4cab758407beebf6@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: Evert Pot - Rooftop Solutions Subject: Re: [PHP-DEV] Restore output buffer in case of exceptions From: evert@rooftopsolutions.nl (Evert | Rooftop) Mehmet Yavuz Selim Soyturk wrote: > Hello, > > I'm sorry if that's the wrong list. > > I am neither a PHP nor a webscripting guy so I'm sorry if this does > not make sense. I just thought that it could be useful. > > PHP 5 supports exception handling. When an exception occurs, PHP does > stack unwinding so that it restores the state of the script. But an > important state of the script does not get restored: the output. Would > it not be a good idea if PHP also did some sort of output buffer > unwinding? > Generally I make sure that the parts of my code that start an output buffer are also responsible for closing the output buffer.. so something like this wouldn't be uncommon in my code.. ob_start(); try { do_something(); } catch (Exception $e) { ob_end_clean(); throw $e; } $data = ob_get_clean();