<?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>php erlang javascript ruby python web linux mac os x</description>
	<lastBuildDate>Fri, 02 Jul 2010 07:19:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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(),这样下去就会出现死循环，这就是为什么程序会出错的原因吧。
通过try catch来处理的话就没有问题。。
function e_handler($e)
{
try
{
throw new Exception();
}
catch (Exception $e)
{
echo &#8220;catched&#8230;&#8221;;
}
}
set_exception_handler(&#8216;e_handler&#8217;);
throw new Exception();
]]></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 />
通过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>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->