<?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"
	>
<channel>
	<title>Comments on: Eval is dead! Long live Eval!</title>
	<atom:link href="http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/</link>
	<description></description>
	<pubDate>Mon, 08 Sep 2008 11:17:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: Jim</title>
		<link>http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/#comment-679325</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Sun, 06 Apr 2008 14:21:28 +0000</pubDate>
		<guid isPermaLink="false">#comment-679325</guid>
		<description>Thanks. Zend Form looks like it might have the potential to what I need to do, though I'm not sure there is any open ended conditional (haven't looked extensively enough).

Pre-written packages aside, I'd be curious to know what PHP function alternatives there are, and how someone can get around something like addslashes(). For example the system call injection didn't work (of course, I didn't test using that exact system call) when I used addslashes.

Thanks - Jim</description>
		<content:encoded><![CDATA[<p>Thanks. Zend Form looks like it might have the potential to what I need to do, though I&#8217;m not sure there is any open ended conditional (haven&#8217;t looked extensively enough).</p>
<p>Pre-written packages aside, I&#8217;d be curious to know what PHP function alternatives there are, and how someone can get around something like addslashes(). For example the system call injection didn&#8217;t work (of course, I didn&#8217;t test using that exact system call) when I used addslashes.</p>
<p>Thanks - Jim</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Lachlan</title>
		<link>http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/#comment-679059</link>
		<dc:creator>Lachlan</dc:creator>
		<pubDate>Sun, 06 Apr 2008 11:24:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-679059</guid>
		<description>Hi Jim,

The cardinal sin with eval is letting it anywhere near user data. With that system you could very easily end up with a bug that resulted in users being able to inject php into your system, for instance by making %x="system('rm -rf /'); 20'. 

It looks like you have a straight-up validation problem, something solved by WACT's form validation library (http://www.phpwact.org/wact/form_validation), or Zend or Symphony. Basically you want to move all of those snippets of eval'd code into small, light objects which you use to validate your user data.</description>
		<content:encoded><![CDATA[<p>Hi Jim,</p>
<p>The cardinal sin with eval is letting it anywhere near user data. With that system you could very easily end up with a bug that resulted in users being able to inject php into your system, for instance by making %x=&#8221;system(&#8217;rm -rf /&#8217;); 20&#8242;. </p>
<p>It looks like you have a straight-up validation problem, something solved by WACT&#8217;s form validation library (http://www.phpwact.org/wact/form_validation), or Zend or Symphony. Basically you want to move all of those snippets of eval&#8217;d code into small, light objects which you use to validate your user data.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Jim</title>
		<link>http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/#comment-678671</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Sun, 06 Apr 2008 05:50:48 +0000</pubDate>
		<guid isPermaLink="false">#comment-678671</guid>
		<description>What I am using eval() for is to do error checking based on some comparison/condition/whatever that is determined when calling the error checking function.

In other words, I would call check_error($user_input,$formula). And then I can have the conditional formula be something like "%x &#62; 10" or "strtoupper(%x)==\"ABC\""... And %x is replaced with $user_input. Totally arbitrary examples, but the point is I as the programmer using the function need full latitude in choosing the conditional formula.

How else can I do this other than by using eval()? And what is the best way to cleanse the user input?

Thanks - Jim</description>
		<content:encoded><![CDATA[<p>What I am using eval() for is to do error checking based on some comparison/condition/whatever that is determined when calling the error checking function.</p>
<p>In other words, I would call check_error($user_input,$formula). And then I can have the conditional formula be something like &#8220;%x &gt; 10&#8243; or &#8220;strtoupper(%x)==\&#8221;ABC\&#8221;"&#8230; And %x is replaced with $user_input. Totally arbitrary examples, but the point is I as the programmer using the function need full latitude in choosing the conditional formula.</p>
<p>How else can I do this other than by using eval()? And what is the best way to cleanse the user input?</p>
<p>Thanks - Jim</p>]]></content:encoded>
	</item>
	<item>
		<title>By: iDownload</title>
		<link>http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/#comment-410041</link>
		<dc:creator>iDownload</dc:creator>
		<pubDate>Tue, 09 Oct 2007 17:24:02 +0000</pubDate>
		<guid isPermaLink="false">#comment-410041</guid>
		<description>Very interesting. But completely disable eval it's not a good idea. It must be the way to limit it functionality using black and white list of functions. I am searching for it now... have anybody idea how to do that?</description>
		<content:encoded><![CDATA[<p>Very interesting. But completely disable eval it&#8217;s not a good idea. It must be the way to limit it functionality using black and white list of functions. I am searching for it now&#8230; have anybody idea how to do that?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: ma214zda</title>
		<link>http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/#comment-395784</link>
		<dc:creator>ma214zda</dc:creator>
		<pubDate>Tue, 25 Sep 2007 01:23:53 +0000</pubDate>
		<guid isPermaLink="false">#comment-395784</guid>
		<description>c749t</description>
		<content:encoded><![CDATA[<p>c749t</p>]]></content:encoded>
	</item>
	<item>
		<title>By: sina salek</title>
		<link>http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/#comment-34414</link>
		<dc:creator>sina salek</dc:creator>
		<pubDate>Sat, 01 Jul 2006 11:01:33 +0000</pubDate>
		<guid isPermaLink="false">#comment-34414</guid>
		<description>i usually use eval to craete complicated classes. it really decrease number of codes, and help to make inherit from main class easily and with less code.
but the big problem is, eval is really slow with loops.</description>
		<content:encoded><![CDATA[<p>i usually use eval to craete complicated classes. it really decrease number of codes, and help to make inherit from main class easily and with less code.<br />
but the big problem is, eval is really slow with loops.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: C~</title>
		<link>http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/#comment-17018</link>
		<dc:creator>C~</dc:creator>
		<pubDate>Tue, 04 Apr 2006 19:24:26 +0000</pubDate>
		<guid isPermaLink="false">#comment-17018</guid>
		<description>I used Eval for dynamically loading code into an ircbot i wrote. As all the modules had to be classes there didn't seem to be a way to add functions to existing classes so i had to use Eval to creat a new class and kinda add it to my existing one.</description>
		<content:encoded><![CDATA[<p>I used Eval for dynamically loading code into an ircbot i wrote. As all the modules had to be classes there didn&#8217;t seem to be a way to add functions to existing classes so i had to use Eval to creat a new class and kinda add it to my existing one.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: sadi</title>
		<link>http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/#comment-8343</link>
		<dc:creator>sadi</dc:creator>
		<pubDate>Mon, 29 Aug 2005 11:00:14 +0000</pubDate>
		<guid isPermaLink="false">#comment-8343</guid>
		<description>I faced a of problem using eval() with javascrip. If there are php or 
simple HTML code then eval is simply ok with me.But when ever i have
to deal with javascript i always found myself in shit. Can anyone 
give me any way to use javascript contained code in eval()?I am 
running behind my time in my project</description>
		<content:encoded><![CDATA[<p>I faced a of problem using eval() with javascrip. If there are php or<br />
simple HTML code then eval is simply ok with me.But when ever i have<br />
to deal with javascript i always found myself in shit. Can anyone<br />
give me any way to use javascript contained code in eval()?I am<br />
running behind my time in my project</p>]]></content:encoded>
	</item>
	<item>
		<title>By: SitePoint Blogs &#187; Blog Archive &#187; How Readable is Your PHP?</title>
		<link>http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/#comment-8259</link>
		<dc:creator>SitePoint Blogs &#187; Blog Archive &#187; How Readable is Your PHP?</dc:creator>
		<pubDate>Thu, 25 Aug 2005 05:09:05 +0000</pubDate>
		<guid isPermaLink="false">#comment-8259</guid>
		<description>[...] One of the entries is titled Every variable should start somewhere. In a previous blog post, I mentioned how frustrating it was to be trying to read some code and asking yourself, &#8216;Where does this variable come from?!&#8217;. Alan labels PHP language constructs such as extract and eval as &#8216;evil&#8217; because they disguise and obfuscate code. That isn&#8217;t news. However he makes a valid point&#8211;that using these types of shortcuts is not a security problem in itself&#8211;the security problem occurs when your code is too hard to understand and you inadvertently introduce additional problems. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] One of the entries is titled Every variable should start somewhere. In a previous blog post, I mentioned how frustrating it was to be trying to read some code and asking yourself, &#8216;Where does this variable come from?!&#8217;. Alan labels PHP language constructs such as extract and eval as &#8216;evil&#8217; because they disguise and obfuscate code. That isn&#8217;t news. However he makes a valid point&#8211;that using these types of shortcuts is not a security problem in itself&#8211;the security problem occurs when your code is too hard to understand and you inadvertently introduce additional problems. [&#8230;]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: joshie</title>
		<link>http://www.sitepoint.com/blogs/2005/02/27/eval-is-dead-long-live-eval/#comment-1853</link>
		<dc:creator>joshie</dc:creator>
		<pubDate>Wed, 31 Dec 1969 19:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-1853</guid>
		<description>&lt;p&gt;allowing dynamic content to be stored in a blog or other cms entry, or page template. (for instance, breadcrumb links in a template page)&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>allowing dynamic content to be stored in a blog or other cms entry, or page template. (for instance, breadcrumb links in a template page)</p>]]></content:encoded>
	</item>
</channel>
</rss>
