<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Zen Space [睿] &#187; exception</title>
	<atom:link href="http://reeze.cn/tag/exception/feed/" rel="self" type="application/rss+xml" />
	<link>http://reeze.cn</link>
	<description>寻找善美</description>
	<lastBuildDate>Mon, 24 Oct 2011 10:42:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PHP5.2.6中无法在exception_handler函数中抛出异常</title>
		<link>http://reeze.cn/2009/06/25/php5-2-6%e4%b8%ad%e6%97%a0%e6%b3%95%e5%9c%a8exception_handler%e5%87%bd%e6%95%b0%e4%b8%ad%e6%8a%9b%e5%87%ba%e5%bc%82%e5%b8%b8/</link>
		<comments>http://reeze.cn/2009/06/25/php5-2-6%e4%b8%ad%e6%97%a0%e6%b3%95%e5%9c%a8exception_handler%e5%87%bd%e6%95%b0%e4%b8%ad%e6%8a%9b%e5%87%ba%e5%bc%82%e5%b8%b8/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 03:03:50 +0000</pubDate>
		<dc:creator>reeze</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[exception]]></category>

		<guid isPermaLink="false">http://reeze.yo2.cn/?p=32551</guid>
		<description><![CDATA[在PHP bugs列表中也找到这个bug，但是似乎没有被处理，bug提出的时间是2005年，不知道新版本的有没有解决。 PHP：5.2.6 OS: Mac OS Leopard 10.5.7 Server: Apache 2.2 这个代码就有问题： function e_handler($e) { throw new Exception(); } set_exception_handler(&#8216;e_handler&#8217;); throw new Exception(); 这将会导致 Fatal error: Exception thrown without a stack frame in Unknown on line 0 Update: 这应该属于设计问题，如果在exception_handler()函数中可以抛出异常，而这个异常又会继续调用exception_handler(),这样下去就会出现死循环，这就是为什么程序会出错的原因吧。 建议在exception_handler函数体内的代码包在try &#8230; <a href="http://reeze.cn/2009/06/25/php5-2-6%e4%b8%ad%e6%97%a0%e6%b3%95%e5%9c%a8exception_handler%e5%87%bd%e6%95%b0%e4%b8%ad%e6%8a%9b%e5%87%ba%e5%bc%82%e5%b8%b8/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>在PHP bugs列表中也找到这个bug，但是似乎没有被处理，bug提出的时间是2005年，不知道新版本的有没有解决。<br />
PHP：5.2.6<br />
OS: Mac OS Leopard 10.5.7<br />
Server: Apache 2.2</p>
<p>这个代码就有问题：<br />
function e_handler($e)<br />
{<br />
throw new Exception();<br />
}<br />
set_exception_handler(&#8216;e_handler&#8217;);<br />
throw new Exception();</p>
<p>这将会导致<br />
Fatal error: Exception thrown without a stack frame in Unknown on line 0</p>
<p><span style="color: #008000;">Update: 这应该属于设计问题，如果在exception_handler()函数中可以抛出异常，而这个异常又会继续调用exception_handler(),这样下去就会出现死循环，这就是为什么程序会出错的原因吧。</span><br />
建议在exception_handler函数体内的代码包在try catch中,避免意外抛出异常导致出这个问题</p>
<p>function e_handler($e)<br />
{<br />
try<br />
{<br />
throw new Exception();<br />
}<br />
catch (Exception $e)<br />
{<br />
echo &#8220;catched&#8230;&#8221;;<br />
}<br />
}<br />
set_exception_handler(&#8216;e_handler&#8217;);</p>
<p>throw new Exception();</p>
]]></content:encoded>
			<wfw:commentRss>http://reeze.cn/2009/06/25/php5-2-6%e4%b8%ad%e6%97%a0%e6%b3%95%e5%9c%a8exception_handler%e5%87%bd%e6%95%b0%e4%b8%ad%e6%8a%9b%e5%87%ba%e5%bc%82%e5%b8%b8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

