<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Why did we use Magic Quotes</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="security.magicquotes.what.html">What are Magic Quotes</a></div> <div class="next" style="text-align: right; float: right;"><a href="security.magicquotes.whynot.html">Why not to use Magic Quotes</a></div> <div class="up"><a href="security.magicquotes.html">Magic Quotes</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="security.magicquotes.why" class="sect1"> <h2 class="title">Why did we use Magic Quotes</h2> <div class="warning"><strong class="warning">Warning</strong><p class="simpara">This feature has been <em class="emphasis">DEPRECATED</em> as of PHP 5.3.0 and <em class="emphasis">REMOVED</em> as of PHP 5.4.0.</p></div> <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> There is no reason to use magic quotes because they are no longer a supported part of <acronym title="PHP: Hypertext Preprocessor">PHP</acronym>. However, they did exist and did help a few beginners blissfully and unknowingly write better (more secure) code. But, when dealing with code that relies upon this behavior it's better to update the code instead of turning magic quotes on. </span> <span class="simpara"> So why did this feature exist? Simple, to help prevent <a href="security.database.sql-injection.html" class="link">SQL Injection</a>. Today developers are better aware of security and end up using database specific escaping mechanisms and/or prepared statements instead of relying upon features like magical quotes. </span> </li> </ul> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="security.magicquotes.what.html">What are Magic Quotes</a></div> <div class="next" style="text-align: right; float: right;"><a href="security.magicquotes.whynot.html">Why not to use Magic Quotes</a></div> <div class="up"><a href="security.magicquotes.html">Magic Quotes</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>