<?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>evardsson.com: stuff that w0rks &#187; Debugging</title>
	<atom:link href="http://www.evardsson.com/blog/tag/debugging/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.evardsson.com/blog</link>
	<description>tweaks and hacks, php, python, music, home and ???</description>
	<lastBuildDate>Mon, 23 Jan 2012 18:38:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Error Handling and the PHP @ Operator</title>
		<link>http://www.evardsson.com/blog/2009/06/07/error-handling-and-the-php-operator/</link>
		<comments>http://www.evardsson.com/blog/2009/06/07/error-handling-and-the-php-operator/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 23:46:56 +0000</pubDate>
		<dc:creator>Sjan Evardsson</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Debugging]]></category>

		<guid isPermaLink="false">http://www.evardsson.com/blog/?p=369</guid>
		<description><![CDATA[I have been trying to debug a plugin for WordPress (Shorten2Ping &#8211; I will keep plugging this because I think it is so nifty!) and I was running into a problem where the plugin would silently fail with nothing in the logs, no error printing to screen, just dead silence. I turned on display_errors in [...]]]></description>
			<content:encoded><![CDATA[<p>I have been trying to debug a plugin for WordPress (<a href="http://www.samuelaguilera.com/archivo/shorten2ping-notifies-pingfm-bitly.xhtml">Shorten2Ping</a> &#8211; I will keep plugging this because I think it is so nifty!) and I was running into a problem where the plugin would silently fail with nothing in the logs, no error printing to screen, just dead silence.</p>
<p>I turned on display_errors in php.ini for a while to see if anything would show up. Still nothing. So I started to look through the file again. I knew it was getting as far as creating the short url in <a href="http://bit.ly">bit.ly</a> before it died, but nothing was getting entered into the database. So I started through the <code>make_bitly_url()</code> function and what jumped out and slapped me in the face? <code>$json = @json_decode($response,true);</code> That little, innocuous-looking @ was gulping the error message from a fatal error! (Namely, &#8220;<code>Call to undefined function json_decode()</code>&#8220;). It turns out that I had PHP compiled with &#8211;disable-json, which is default for Gentoo <em>unless</em> you have json in your USE flags.</p>
<p>According to the PHP docs for the Error Control Operator @:</p>
<blockquote>
<p id="line78">Currently the &#8220;@&#8221; error-control operator prefix will even disable error reporting for critical errors that will terminate script execution. Among other things, this means that if you use &#8220;@&#8221; to suppress errors from a certain function and either it isn&#8217;t available or has been mistyped, the script will die right there with no indication as to why.</p>
</blockquote>
<p>So, if you really must supress error messages, do so, but do so with care. In the case where a suppressed error may be fatal (as in this case) be sure to add documentation to that effect. As in &#8220;If this dies a silent death it may very well be that you do not have function xyz() enabled.&#8221;</p>
<p>And, note to self, when debugging PHP, the first thing to do is look for and remove the error control operator.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evardsson.com/blog/2009/06/07/error-handling-and-the-php-operator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

