<?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: Models In The Zend Framework &#8211; Part 2</title>
	<atom:link href="http://www.techfounder.net/2008/05/21/models-in-the-zend-framework-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techfounder.net/2008/05/21/models-in-the-zend-framework-part-2/</link>
	<description>Blog about web development and Internet entrepreneurship</description>
	<lastBuildDate>Wed, 03 Mar 2010 01:05:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Grantus Maximus Web Blog &#187; Wheres the Model in Zend Frameworks MVC?</title>
		<link>http://www.techfounder.net/2008/05/21/models-in-the-zend-framework-part-2/comment-page-1/#comment-714</link>
		<dc:creator>Grantus Maximus Web Blog &#187; Wheres the Model in Zend Frameworks MVC?</dc:creator>
		<pubDate>Fri, 05 Dec 2008 13:07:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.techfounder.net/?p=24#comment-714</guid>
		<description>[...] just about to start my next and decided to see if there is a better solution out there&#8230; The best article I&#8217;ve found was at techfounder and was proposing the second option as well and had some good [...]</description>
		<content:encoded><![CDATA[<p>[...] just about to start my next and decided to see if there is a better solution out there&#8230; The best article I&#8217;ve found was at techfounder and was proposing the second option as well and had some good [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wheres the Model in Zend Frameworks MVC? &#124; Child of the Machine</title>
		<link>http://www.techfounder.net/2008/05/21/models-in-the-zend-framework-part-2/comment-page-1/#comment-713</link>
		<dc:creator>Wheres the Model in Zend Frameworks MVC? &#124; Child of the Machine</dc:creator>
		<pubDate>Fri, 05 Dec 2008 13:02:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.techfounder.net/?p=24#comment-713</guid>
		<description>[...] just about to start my next and decided to see if there is a better solution out there&#8230; The best article I&#8217;ve found was at techfounder and was proposing the second option as well and had some good examples.  I&#8217;d be interested to [...]</description>
		<content:encoded><![CDATA[<p>[...] just about to start my next and decided to see if there is a better solution out there&#8230; The best article I&#8217;ve found was at techfounder and was proposing the second option as well and had some good examples.  I&#8217;d be interested to [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eran Galperin</title>
		<link>http://www.techfounder.net/2008/05/21/models-in-the-zend-framework-part-2/comment-page-1/#comment-80</link>
		<dc:creator>Eran Galperin</dc:creator>
		<pubDate>Fri, 11 Jul 2008 19:34:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.techfounder.net/?p=24#comment-80</guid>
		<description>Yes, you are absolutely correct - thanks for pointing that out :)

As can be inferred, I used example code from my start-up Octabox in which I employ this solution extensively.</description>
		<content:encoded><![CDATA[<p>Yes, you are absolutely correct &#8211; thanks for pointing that out <img src='http://www.techfounder.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>As can be inferred, I used example code from my start-up Octabox in which I employ this solution extensively.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://www.techfounder.net/2008/05/21/models-in-the-zend-framework-part-2/comment-page-1/#comment-79</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Fri, 11 Jul 2008 15:56:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.techfounder.net/?p=24#comment-79</guid>
		<description>Hey, this was exactly what I was looking for. Coming from a Rails background I had trouble wrapping my head around how to put validation in the models. ZF&#039;s approach is so much more decoupled than Rails&#039; model/validation mechanism. Pretty interesting. One question: The first code example is with a class named Techfounder_Db_Model, while the second class, which adds the update and insert methods, is named Octabox_Db_Model. That should be Techfounder_Db_Model too, correct?</description>
		<content:encoded><![CDATA[<p>Hey, this was exactly what I was looking for. Coming from a Rails background I had trouble wrapping my head around how to put validation in the models. ZF&#8217;s approach is so much more decoupled than Rails&#8217; model/validation mechanism. Pretty interesting. One question: The first code example is with a class named Techfounder_Db_Model, while the second class, which adds the update and insert methods, is named Octabox_Db_Model. That should be Techfounder_Db_Model too, correct?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matthijs</title>
		<link>http://www.techfounder.net/2008/05/21/models-in-the-zend-framework-part-2/comment-page-1/#comment-31</link>
		<dc:creator>matthijs</dc:creator>
		<pubDate>Mon, 26 May 2008 08:58:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.techfounder.net/?p=24#comment-31</guid>
		<description>It is a pretty difficult subject (also for me). I just remembered this article http://www.webappsec.org/projects/articles/091007.shtml
which explains the sql injection issue in more detail. An excellent read. And together with the examples you can test locally, it makes it obvious that it&#039;s not as simple as use function A to protect for B or C for D, but there&#039;s a lot more to think about for every query one writes. So me saying mysql_real_escape_string() is pretty bullet-proof is not entirely true .. I must also stand corrected.</description>
		<content:encoded><![CDATA[<p>It is a pretty difficult subject (also for me). I just remembered this article <a href="http://www.webappsec.org/projects/articles/091007.shtml" rel="nofollow">http://www.webappsec.org/projects/articles/091007.shtml</a><br />
which explains the sql injection issue in more detail. An excellent read. And together with the examples you can test locally, it makes it obvious that it&#8217;s not as simple as use function A to protect for B or C for D, but there&#8217;s a lot more to think about for every query one writes. So me saying mysql_real_escape_string() is pretty bullet-proof is not entirely true .. I must also stand corrected.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eran Galperin</title>
		<link>http://www.techfounder.net/2008/05/21/models-in-the-zend-framework-part-2/comment-page-1/#comment-30</link>
		<dc:creator>Eran Galperin</dc:creator>
		<pubDate>Mon, 26 May 2008 08:20:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.techfounder.net/?p=24#comment-30</guid>
		<description>I&#039;ve been reading about SQL injection attacks recently and it appears that you might be right. It&#039;s better to use the Zend_Db intrinsic quoting functions that use the real_escape_string methods of the different adapters.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been reading about SQL injection attacks recently and it appears that you might be right. It&#8217;s better to use the Zend_Db intrinsic quoting functions that use the real_escape_string methods of the different adapters.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matthijs</title>
		<link>http://www.techfounder.net/2008/05/21/models-in-the-zend-framework-part-2/comment-page-1/#comment-29</link>
		<dc:creator>matthijs</dc:creator>
		<pubDate>Mon, 26 May 2008 06:45:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.techfounder.net/?p=24#comment-29</guid>
		<description>I&#039;m no security expert either, but I&#039;m pretty sure that&#039;s not true. Htmlentities is not the function to be used to protect against sql injection. If you want more protection against that you can also use prepared statements (using PDO for example). I&#039;m also pretty sure that mysql_real_escape_string is bullet-proof (although in security terms you are not allowed to speak about 100% security). 

Htmlentities is the recommended practice to escape html to prevent XSS, but that&#039;s a whole different security problem which has nothing to do with the db.

Both Chris Shiflett and Ilia Alshanetsky have both books and sites with some pretty good info on these subjects.</description>
		<content:encoded><![CDATA[<p>I&#8217;m no security expert either, but I&#8217;m pretty sure that&#8217;s not true. Htmlentities is not the function to be used to protect against sql injection. If you want more protection against that you can also use prepared statements (using PDO for example). I&#8217;m also pretty sure that mysql_real_escape_string is bullet-proof (although in security terms you are not allowed to speak about 100% security). </p>
<p>Htmlentities is the recommended practice to escape html to prevent XSS, but that&#8217;s a whole different security problem which has nothing to do with the db.</p>
<p>Both Chris Shiflett and Ilia Alshanetsky have both books and sites with some pretty good info on these subjects.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eran Galperin</title>
		<link>http://www.techfounder.net/2008/05/21/models-in-the-zend-framework-part-2/comment-page-1/#comment-26</link>
		<dc:creator>Eran Galperin</dc:creator>
		<pubDate>Sat, 24 May 2008 22:37:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.techfounder.net/?p=24#comment-26</guid>
		<description>To my knowledge the mysql_real_escape function is not bullet-proof, and htmlentities provides better protection. Of course I would like to preserve the original data in its form, but better escape than suffer an attack. Again, I&#039;m no security expert but as far as I know htmlentities is the recommended practice under PHP.</description>
		<content:encoded><![CDATA[<p>To my knowledge the mysql_real_escape function is not bullet-proof, and htmlentities provides better protection. Of course I would like to preserve the original data in its form, but better escape than suffer an attack. Again, I&#8217;m no security expert but as far as I know htmlentities is the recommended practice under PHP.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matthijs</title>
		<link>http://www.techfounder.net/2008/05/21/models-in-the-zend-framework-part-2/comment-page-1/#comment-25</link>
		<dc:creator>matthijs</dc:creator>
		<pubDate>Sat, 24 May 2008 21:39:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.techfounder.net/?p=24#comment-25</guid>
		<description>I understand that htmlentities is for &quot;security&quot; reasons. But the thing is, escaping output is context dependent. So say an ampersand &amp;. That doesn&#039;t have to be escaped if it&#039;s inserted in a database, because in that context it does no harm. However, when it is outputted to HTML, it needs to be escaped with htmlentities to keep your HTML valid (no real security risk there, but that&#039;s just this example).
 
The basic principle is that you want to keep your data the way it is original. using htmlentities before inserting it in the db changes the data for no reason. Because htmlentities does nothing in the context of inserting data in a db. Only when outputting data to HTML is htmlentities of use. When you insert data in a db, it needs to be escaped using a function that is useful in that context. That&#039;s mysql_real_escape_string for mysql.</description>
		<content:encoded><![CDATA[<p>I understand that htmlentities is for &#8220;security&#8221; reasons. But the thing is, escaping output is context dependent. So say an ampersand &amp;. That doesn&#8217;t have to be escaped if it&#8217;s inserted in a database, because in that context it does no harm. However, when it is outputted to HTML, it needs to be escaped with htmlentities to keep your HTML valid (no real security risk there, but that&#8217;s just this example).</p>
<p>The basic principle is that you want to keep your data the way it is original. using htmlentities before inserting it in the db changes the data for no reason. Because htmlentities does nothing in the context of inserting data in a db. Only when outputting data to HTML is htmlentities of use. When you insert data in a db, it needs to be escaped using a function that is useful in that context. That&#8217;s mysql_real_escape_string for mysql.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eran Galperin</title>
		<link>http://www.techfounder.net/2008/05/21/models-in-the-zend-framework-part-2/comment-page-1/#comment-24</link>
		<dc:creator>Eran Galperin</dc:creator>
		<pubDate>Sat, 24 May 2008 17:47:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.techfounder.net/?p=24#comment-24</guid>
		<description>htmlentities is for security reasons obviously. I&#039;m not a security expert, so I have to use brute-force. If you have a better idea you are welcome to suggest :)</description>
		<content:encoded><![CDATA[<p>htmlentities is for security reasons obviously. I&#8217;m not a security expert, so I have to use brute-force. If you have a better idea you are welcome to suggest <img src='http://www.techfounder.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
