<?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>Matthew Turland &#187; CDC</title>
	<atom:link href="http://matthewturland.com/tag/cdc/feed/" rel="self" type="application/rss+xml" />
	<link>http://matthewturland.com</link>
	<description></description>
	<lastBuildDate>Sun, 18 Jul 2010 14:29:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>CDC Update</title>
		<link>http://matthewturland.com/2009/04/09/cdc-update/</link>
		<comments>http://matthewturland.com/2009/04/09/cdc-update/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 02:01:32 +0000</pubDate>
		<dc:creator>Matthew Turland</dc:creator>
				<category><![CDATA[CDC]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[While using cdc recently after having written about it, I ran into an odd issue. While doing a lint check on a code block, a parse error was occurring on a line that contained a comment in the original source file. The original code block to do this lint check had the line below to [...]]]></description>
			<content:encoded><![CDATA[<p>While using <a href="http://github.com/elazar/cdc/tree/master" title="elazar's cdc at master - GitHub">cdc</a> recently after having <a href="http://blueparabola.com/blog/writing-cdc" title="On Writing CDC | Blue Parabola, LLC">written about it</a>, I ran into an odd issue. While doing a lint check on a code block, a parse error was occurring on a line that contained a comment in the original source file.</p>
<p>The original code block to do this lint check had the line below to do the heavy lifting.</p>
<pre>$response = shell_exec('echo ' . escapeshellarg($code) . ' | php -l');</pre>
<p>A var_dump() on $code revealed this, where the comment line was the line on which the parse error was occurring.</p>
<pre>string(474) &quot;&lt;?php
...
// Matches any of the standard escape sequences \r, \n, or \t
$matches = (preg_match('/\\r|\\n|\\t/', $string) == 1);
...
?&gt;&quot;</pre>
<p>Presumably what was happening was, even though the var_dump() call showed that actual newlines were being interpreted correctly, the \r was also being interpreted rather than taken literally. This caused the comma following it to generate the error I was receiving, namely &quot;Parse error: syntax error, unexpected &#8216;,&#8217;.&quot; (If you know why this is, I&#8217;m very curious to find out.)</p>
<p>Luckily I was able to tag <a href="http://derickrethans.nl/who.php" title="About Me - Derick Rethans">Derick</a> and he pointed me in the direction of an alternative: <a href="http://php.net/proc_open" title="PHP: proc_open - Manual">proc_open</a>, which even has an example for executing a PHP file that works just as well when modified to perform a lint check on a PHP file. You can see the code changes in the <a href="http://github.com/elazar/cdc/commit/2f549d8e9ca6748b133db0bc047f241ade348bff#L0R153" title="Commit 2f549d8e9ca6748b133db0bc047f241ade348bff to elazar's cdc - GitHub">related git commit</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://matthewturland.com/2009/04/09/cdc-update/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
