<?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: Using Eval in PHP</title>
	<atom:link href="http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/</link>
	<description>The weblog of Joshua Eichorn, AJAX, PHP and Open Source</description>
	<pubDate>Wed, 20 Aug 2008 17:14:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1-alpha</generator>
		<item>
		<title>By: sharpskater69</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/#comment-498987</link>
		<dc:creator>sharpskater69</dc:creator>
		<pubDate>Thu, 19 Jun 2008 19:24:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=166#comment-498987</guid>
		<description>good. consider using /\W/, much easier in your example. good though.</description>
		<content:encoded><![CDATA[<p>good. consider using /\W/, much easier in your example. good though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PHP security &#124; TheStruggle</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/#comment-391134</link>
		<dc:creator>PHP security &#124; TheStruggle</dc:creator>
		<pubDate>Fri, 22 Feb 2008 14:22:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=166#comment-391134</guid>
		<description>[...] dangerous. If you have to then make sure you check the content of the string before you use it. Try this for more [...]</description>
		<content:encoded><![CDATA[<p>[...] dangerous. If you have to then make sure you check the content of the string before you use it. Try this for more [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Braunewell</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/#comment-5733</link>
		<dc:creator>Stefan Braunewell</dc:creator>
		<pubDate>Mon, 13 Feb 2006 15:17:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=166#comment-5733</guid>
		<description>Eval is not inherently slow, it just has a small constant run-time every time it's called. To assess the speed of eval() php parsing itself, you can put the for-loop inside the eval function. Results:

Eval: 1000000 times took 8.4494090080261
Same code not eval:  1000000 times took 0.83726000785828
Loop in eval took 1.0076489448547

You can see: executing code in eval is not the problem - envoking it so many times is.</description>
		<content:encoded><![CDATA[<p>Eval is not inherently slow, it just has a small constant run-time every time it&#8217;s called. To assess the speed of eval() php parsing itself, you can put the for-loop inside the eval function. Results:</p>
<p>Eval: 1000000 times took 8.4494090080261<br />
Same code not eval:  1000000 times took 0.83726000785828<br />
Loop in eval took 1.0076489448547</p>
<p>You can see: executing code in eval is not the problem - envoking it so many times is.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua Eichorn</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/#comment-5213</link>
		<dc:creator>Joshua Eichorn</dc:creator>
		<pubDate>Mon, 21 Nov 2005 15:16:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=166#comment-5213</guid>
		<description>Jorge:
In a situation like that is no great way to garentee security.  What you'll want to do is remove the runtime eval by just writing the new code to files (helps performance too) and then focus on making sure that only the admin can write new code.</description>
		<content:encoded><![CDATA[<p>Jorge:<br />
In a situation like that is no great way to garentee security.  What you&#8217;ll want to do is remove the runtime eval by just writing the new code to files (helps performance too) and then focus on making sure that only the admin can write new code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jorge</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/#comment-5212</link>
		<dc:creator>Jorge</dc:creator>
		<pubDate>Mon, 21 Nov 2005 09:43:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=166#comment-5212</guid>
		<description>Hello, its a very interesting article. I am building a cms and considered eval to allow the cms admin to write modules on the fly using php and eval. I know that eval is quite dangerous and that's why I'm lookig for information about coding it safely. What do you think about it? Should I try something different? Do you think it is possible to make it safely anyway?

Jorge</description>
		<content:encoded><![CDATA[<p>Hello, its a very interesting article. I am building a cms and considered eval to allow the cms admin to write modules on the fly using php and eval. I know that eval is quite dangerous and that&#8217;s why I&#8217;m lookig for information about coding it safely. What do you think about it? Should I try something different? Do you think it is possible to make it safely anyway?</p>
<p>Jorge</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua Eichorn</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/#comment-4297</link>
		<dc:creator>Joshua Eichorn</dc:creator>
		<pubDate>Thu, 11 Aug 2005 15:59:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=166#comment-4297</guid>
		<description>Hayley thanks for the catch, that was just flipping things around, I say whitelist in the next sentence as well.  Also it I think your second comment got cut off, what returns the list of characters.

Also you can limit things however you want, its really just a matter of keeping out anything that will cause a security problem and meeting the needs of your situation.</description>
		<content:encoded><![CDATA[<p>Hayley thanks for the catch, that was just flipping things around, I say whitelist in the next sentence as well.  Also it I think your second comment got cut off, what returns the list of characters.</p>
<p>Also you can limit things however you want, its really just a matter of keeping out anything that will cause a security problem and meeting the needs of your situation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hayley Watson</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/#comment-4296</link>
		<dc:creator>Hayley Watson</dc:creator>
		<pubDate>Thu, 11 Aug 2005 14:10:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=166#comment-4296</guid>
		<description>
Returns a list of all (uppercase) characters that are allowed to start function names. It is surprisingly extensive, but do you have to allow ALL of them in function names you create at runtime?

Adapting it to find legal subsequent characters is straightforward. The only glitch you might experience is with _(), if you have the gettext extension installed.</description>
		<content:encoded><![CDATA[<p>Returns a list of all (uppercase) characters that are allowed to start function names. It is surprisingly extensive, but do you have to allow ALL of them in function names you create at runtime?</p>
<p>Adapting it to find legal subsequent characters is straightforward. The only glitch you might experience is with _(), if you have the gettext extension installed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hayley Watson</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/#comment-4295</link>
		<dc:creator>Hayley Watson</dc:creator>
		<pubDate>Thu, 11 Aug 2005 13:51:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=166#comment-4295</guid>
		<description>"its always easier to make a blacklist rather then a white list."
Haven't you got those back to front? A whitelist (in this context) being the charaters that ARE allowed in a function name, and a blacklist being the ones that are NOT. It's easy enough to make a list of all the allowable characters (the whitelist), but the only reliable way of making the blacklist would be to start with a list containing every character and subtract the whitelist.

Whitelisting gives you a list of everything you allow, while blacklisting requires guessing every possible thing that you shouldn't allow.</description>
		<content:encoded><![CDATA[<p>&#8220;its always easier to make a blacklist rather then a white list.&#8221;<br />
Haven&#8217;t you got those back to front? A whitelist (in this context) being the charaters that ARE allowed in a function name, and a blacklist being the ones that are NOT. It&#8217;s easy enough to make a list of all the allowable characters (the whitelist), but the only reliable way of making the blacklist would be to start with a list containing every character and subtract the whitelist.</p>
<p>Whitelisting gives you a list of everything you allow, while blacklisting requires guessing every possible thing that you shouldn&#8217;t allow.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: HotPHPPER News</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/#comment-4286</link>
		<dc:creator>HotPHPPER News</dc:creator>
		<pubDate>Sun, 07 Aug 2005 13:30:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=166#comment-4286</guid>
		<description>&lt;strong&gt;PHPのevalは遅い&lt;/strong&gt;

フレームワークguessworkの開発者によるブログ「BMediaNode」にて
「Using Eval in PHP」の要約が書かれています。

PHPのeval関数はベタにコードを記述した場合に比べてPHP 4.3.10で10倍程度、PHP 5.1 bet</description>
		<content:encoded><![CDATA[<p><strong>PHPのevalは遅い</strong></p>
<p>フレームワークguessworkの開発者によるブログ「BMediaNode」にて<br />
「Using Eval in PHP」の要約が書かれています。</p>
<p>PHPのeval関数はベタにコードを記述した場合に比べてPHP 4.3.10で10倍程度、PHP 5.1 bet</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua Eichorn</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/#comment-4260</link>
		<dc:creator>Joshua Eichorn</dc:creator>
		<pubDate>Tue, 02 Aug 2005 01:46:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=166#comment-4260</guid>
		<description>I belive the only option is call_user_func_array

Something like below seems to work:

class Test {
        function blah(&#38;$test) {
                $test-&#62;blah = "blah was here";
        }
}

$i = new Test();

call_user_func_array(array('Test','blah'),array(&#38;$i));

var_dump($i-&#62;blah);
</description>
		<content:encoded><![CDATA[<p>I belive the only option is call_user_func_array</p>
<p>Something like below seems to work:</p>
<p>class Test {<br />
        function blah(&amp;$test) {<br />
                $test-&gt;blah = &#8220;blah was here&#8221;;<br />
        }<br />
}</p>
<p>$i = new Test();</p>
<p>call_user_func_array(array(&#8217;Test&#8217;,'blah&#8217;),array(&amp;$i));</p>
<p>var_dump($i-&gt;blah);</p>
]]></content:encoded>
	</item>
</channel>
</rss>
