<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Dying with grace &#8211; PHP&#8217;s register_shutdown_function</title>
	<atom:link href="http://blog.eirikhoem.net/index.php/2008/03/15/dying-with-grace-phps-register_shutdown_function/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.eirikhoem.net/index.php/2008/03/15/dying-with-grace-phps-register_shutdown_function/</link>
	<description>PHP, AS3, Flex, Flash</description>
	<lastBuildDate>Tue, 29 Jun 2010 14:08:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Daniel</title>
		<link>http://blog.eirikhoem.net/index.php/2008/03/15/dying-with-grace-phps-register_shutdown_function/comment-page-1/#comment-292</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Tue, 26 Aug 2008 08:04:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.eirikhoem.net/?p=27#comment-292</guid>
		<description>This functionality can be used in web application, IMHO, if you have large legacy codebase which runs as complex CMS / CRM.

For example if you work with very large (and very old) system usually there is no enough time (and money) to write all legacy stuff from the beginning or even do necessary refactoring. New code very often uses legacy functionality.

Of course QA are not able to test everything and unit tests do not exist for legacy functionality. As a result, from time to time fatal errors can occur in production environment (user sees white screen or not completed layout).

register_shutdown_function could help with display user friendly message to make sure customer will not be wondering what just has happened.</description>
		<content:encoded><![CDATA[<p>This functionality can be used in web application, IMHO, if you have large legacy codebase which runs as complex CMS / CRM.</p>
<p>For example if you work with very large (and very old) system usually there is no enough time (and money) to write all legacy stuff from the beginning or even do necessary refactoring. New code very often uses legacy functionality.</p>
<p>Of course QA are not able to test everything and unit tests do not exist for legacy functionality. As a result, from time to time fatal errors can occur in production environment (user sees white screen or not completed layout).</p>
<p>register_shutdown_function could help with display user friendly message to make sure customer will not be wondering what just has happened.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Etibar</title>
		<link>http://blog.eirikhoem.net/index.php/2008/03/15/dying-with-grace-phps-register_shutdown_function/comment-page-1/#comment-291</link>
		<dc:creator>Etibar</dc:creator>
		<pubDate>Tue, 26 Aug 2008 08:03:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.eirikhoem.net/?p=27#comment-291</guid>
		<description>PHP documentation says that “The registered shutdown functions are called after the request has been completed (including sending any output buffers), so it is not possible to send output to the browser using echo() or print(), or retrieve the contents of any output buffers using ob_get_contents(). ”

Am I missing anything or… ?</description>
		<content:encoded><![CDATA[<p>PHP documentation says that “The registered shutdown functions are called after the request has been completed (including sending any output buffers), so it is not possible to send output to the browser using echo() or print(), or retrieve the contents of any output buffers using ob_get_contents(). ”</p>
<p>Am I missing anything or… ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://blog.eirikhoem.net/index.php/2008/03/15/dying-with-grace-phps-register_shutdown_function/comment-page-1/#comment-54</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 20 Mar 2008 11:48:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.eirikhoem.net/?p=27#comment-54</guid>
		<description>@zhaiduo:

$clean never gets set to true since the script fails with a fatal error at line 13. The shutdown_func gets executed anyways, and it checks if $clean is true or not. If it&#039;s false it will output info.</description>
		<content:encoded><![CDATA[<p>@zhaiduo:</p>
<p>$clean never gets set to true since the script fails with a fatal error at line 13. The shutdown_func gets executed anyways, and it checks if $clean is true or not. If it&#8217;s false it will output info.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zhaiduo</title>
		<link>http://blog.eirikhoem.net/index.php/2008/03/15/dying-with-grace-phps-register_shutdown_function/comment-page-1/#comment-53</link>
		<dc:creator>zhaiduo</dc:creator>
		<pubDate>Wed, 19 Mar 2008 07:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.eirikhoem.net/?p=27#comment-53</guid>
		<description>Can&#039;t see the difference, whatever $clean is true or not. But I think register_shutdown_function is some useful. B-)</description>
		<content:encoded><![CDATA[<p>Can&#8217;t see the difference, whatever $clean is true or not. But I think register_shutdown_function is some useful. B-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eirikhoem</title>
		<link>http://blog.eirikhoem.net/index.php/2008/03/15/dying-with-grace-phps-register_shutdown_function/comment-page-1/#comment-48</link>
		<dc:creator>eirikhoem</dc:creator>
		<pubDate>Mon, 17 Mar 2008 14:20:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.eirikhoem.net/?p=27#comment-48</guid>
		<description>@Josh

Thanks for the feedback. I fully agree that it can be very usable in a CLI context, and I do use it in several scripts which needs summaries etc.

Did you see the discussion over at Richard Heyes (&quot;phpguru&quot;) blog?

He made a follow up on my post where he states his disagreements regarding the usage I present. I agree that avoiding / catching errors is a must, but this code we have here actually lets the developer present information when a fatal error comes along. I don&#039;t think I made that clear enough in my initial post, so I&#039;ve updated it.

I did not consider your point regarding the PHP/Apache thread cleaning up when writing this post, but I do find it pretty interesting.</description>
		<content:encoded><![CDATA[<p>@Josh</p>
<p>Thanks for the feedback. I fully agree that it can be very usable in a CLI context, and I do use it in several scripts which needs summaries etc.</p>
<p>Did you see the discussion over at Richard Heyes (&#8220;phpguru&#8221;) blog?</p>
<p>He made a follow up on my post where he states his disagreements regarding the usage I present. I agree that avoiding / catching errors is a must, but this code we have here actually lets the developer present information when a fatal error comes along. I don&#8217;t think I made that clear enough in my initial post, so I&#8217;ve updated it.</p>
<p>I did not consider your point regarding the PHP/Apache thread cleaning up when writing this post, but I do find it pretty interesting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PHP Weekly Reader - May 16th 2008 : phpaddiction</title>
		<link>http://blog.eirikhoem.net/index.php/2008/03/15/dying-with-grace-phps-register_shutdown_function/comment-page-1/#comment-47</link>
		<dc:creator>PHP Weekly Reader - May 16th 2008 : phpaddiction</dc:creator>
		<pubDate>Mon, 17 Mar 2008 05:41:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.eirikhoem.net/?p=27#comment-47</guid>
		<description>[...] didn&#039;t agree with  Dying with grace - PHP’s register_shutdown_function but it lead me to read this  Re: Shutdown error handlers  which makes me wonder why I click on [...]</description>
		<content:encoded><![CDATA[<p>[...] didn&#8217;t agree with  Dying with grace &#8211; PHP’s register_shutdown_function but it lead me to read this  Re: Shutdown error handlers  which makes me wonder why I click on [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh</title>
		<link>http://blog.eirikhoem.net/index.php/2008/03/15/dying-with-grace-phps-register_shutdown_function/comment-page-1/#comment-46</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Sun, 16 Mar 2008 13:45:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.eirikhoem.net/?p=27#comment-46</guid>
		<description>This is definitely useful in a CLI context, where a user may decide to prematurely terminate a long-running CLI script, and it can clean up after itself - maybe even print some last-minute report info. The Windows ping utility works similarly.

However, in my opinion, shutdown functions have no place in a web-based context. Errors should be handled properly - caught, or better still, avoided in the first place. On the occasion that a system issue, such as a power outage (and brief UPS lifeline), causes your script to execute, you could have hundreds of PHP/Apache threads running around trying to clean up after themselves when the system should be halting.

I guess it comes down to one key issue - you attempt to die in grace when you should have no need to die at all, or should not waste CPU cycles with grace on the odd occasion you do.</description>
		<content:encoded><![CDATA[<p>This is definitely useful in a CLI context, where a user may decide to prematurely terminate a long-running CLI script, and it can clean up after itself &#8211; maybe even print some last-minute report info. The Windows ping utility works similarly.</p>
<p>However, in my opinion, shutdown functions have no place in a web-based context. Errors should be handled properly &#8211; caught, or better still, avoided in the first place. On the occasion that a system issue, such as a power outage (and brief UPS lifeline), causes your script to execute, you could have hundreds of PHP/Apache threads running around trying to clean up after themselves when the system should be halting.</p>
<p>I guess it comes down to one key issue &#8211; you attempt to die in grace when you should have no need to die at all, or should not waste CPU cycles with grace on the odd occasion you do.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
