<p>Hi Julian,</p>
<p>from a security perspective the use of stripslashes is a bad idea.</p>
<p>The magic quotes feature adds these backslashes to escape the &quot;dangerous&quot; characters (i.e. &#39;) for database use.</p>
<p>Basically it&#39;s a weak version of what sqlite_escape_string et al are doing and stripslashes reverts this.</p>
<p>If the intention is to remove all backslashes, stripslashes is definately not the right function. All that&#39;s required to defeat it is using two backslashes for one to remain.</p>
<p>As for the expected need: In our case it&#39;ll probably be about every second drop-off as users will be asked to upload a file in some more or less arbitrary directory for analysis.</p>
<p>To recap: stripslashes does nothing to improve security, all it does is decrease security if *_escape_string is forgotten, magic_quotes is either on or off.<br>
Additionally it&#39;ll  garble user input if magic_quotes off (which is the default for new installs).</p>
<p>Cheers<br>
Jörg</p>
<div class="gmail_quote">Am 03.02.2012 18:12 schrieb &quot;Jules&quot; &lt;<a href="mailto:Jules@zend.to">Jules@zend.to</a>&gt;:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
How often do people need to put in backslashes? Versus the danger of<br>
missing an instance of escaping-based injection because of not removing<br>
them? I would personally prefer to play safe.<br>
<br>
If we can *guarantee* that it won&#39;t lessen security *at all*, then we<br>
can not remove all backslashes.<br>
<br>
Jules.<br>
<br>
On 03/02/2012 16:49, Joerg Streibhardt wrote:<br>
&gt; Hi Jules<br>
&gt;<br>
&gt; my first real user informed me that the backslashes he typed into the<br>
&gt; message were removed.<br>
&gt; After looking around for a bit I noticed that most if not all<br>
&gt; instances of stripslashes are called whether PHP added those &quot;magic<br>
&gt; quotes&quot; or not.<br>
&gt;<br>
&gt; Unfortunately I&#39;m unable to globally enable magic quotes and the<br>
&gt; manual states that:<br>
&gt;<br>
&gt;&gt; This feature has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.<br>
&gt;&gt; <a href="http://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc" target="_blank">http://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc</a><br>
&gt; I&#39;ve changed the setting locally for ZendTo by adding<br>
&gt;&gt; php_flag magic_quotes_gpc on<br>
&gt; in the apache-configuration for&lt;Directory /opt/zendto/www/&gt;.<br>
&gt;<br>
&gt; I think stripslashes should only be used if get_magic_quotes_gpc()<br>
&gt; returns true. Removing it altogether is probably not a good idea at<br>
&gt; this time.<br>
&gt;<br>
&gt; What do you think?<br>
&gt;<br>
&gt; Cheers<br>
&gt; Jörg<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; ZendTo mailing list<br>
&gt; <a href="mailto:ZendTo@zend.to">ZendTo@zend.to</a><br>
&gt; <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto" target="_blank">http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto</a><br>
<br>
Jules<br>
<br>
--<br>
Julian Field MEng CITP CEng<br>
<a href="http://www.Zend.To" target="_blank">www.Zend.To</a><br>
<br>
Follow me at <a href="http://twitter.com/JulesFM" target="_blank">twitter.com/JulesFM</a><br>
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654<br>
<br>
&#39;It&#39;s okay to live without all the answers&#39; - Charlie Eppes, 2011<br>
&#39;All programs have a desire to be useful&#39; - Tron, 1982<br>
&#39;That is the land of lost content,<br>
  I see it shining plain,<br>
  The happy highways where I went,<br>
  And cannot come again.&#39; - A.E. Houseman<br>
<br>
<br>
_______________________________________________<br>
ZendTo mailing list<br>
<a href="mailto:ZendTo@zend.to">ZendTo@zend.to</a><br>
<a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto" target="_blank">http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto</a><br>
</blockquote></div>