<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 23 May 2012 04:11:46 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Working Software Blog: Escaping single and double quotes for use with XPath queries in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16746</guid>
      <link>http://www.phpdeveloper.org/news/16746</link>
      <description><![CDATA[<p>
On the Working Software blog there's a new post showing a solution to a issue with <a href="http://www.workingsoftware.com.au/page/Escaping_single_and_double_quotes_in_XPath_queries_in_PHP">escaping quotes in XPath queries</a> that's not just an issue in PHP.
</p>
<blockquote>
I've been working with the Basecamp API to plugin our IRC bot that we use for time tracking and I'm astounded to learn that escaping single and/or double quotes for XPath queries in PHP does not have a well documented, best practices solution. In fact, it seems as though this is not peculiar to PHP. I took a look around and found this excellent article by "Kushal": <a href="http://kushalm.com/the-perils-of-xpath-expressions-specifically-escaping-quotes">http://kushalm.com/the-perils-of-xpath-expressions-specifically-escaping-quotes</a>.
</blockquote>
<p>
He's put together <a href="https://gist.github.com/1155973">his own (PHP) solution</a> to the problem - running the entire XPath query through a filtering method that splits it up, replaces the quote characters and combines it back down to a single string.
</p>]]></description>
      <pubDate>Fri, 19 Aug 2011 13:50:14 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Alan Skorkin's Blog: How To Fix The WP-Syntax Special Character Escaping Issue]]></title>
      <guid>http://www.phpdeveloper.org/news/14167</guid>
      <link>http://www.phpdeveloper.org/news/14167</link>
      <description><![CDATA[<p>
<i>Alan Skorkin</i> has a recent post to his blog about a trouble that many WordPress users have come across in working with their content and the <a href="http://wordpress.org/extend/plugins/wp-syntax/">WP-Syntax</a> plugin (for displaying code) - a special character escaping bug that escapes characters that don't need it.
</p>
<blockquote>
Suffice to say, [WP-Syntax] does the job fine except for one very annoying issue. Whenever you have any kind of special characters in your code (which you inevitably do e.g. <, >, & etc.), these always render as their escaped representations.
</blockquote>
<p>
It only happens with the WYSIWYG editor for writing content (which the tool's FAQ recommends turning off) but there's a better solution that <i>Alan</i> found - change a line of code in the plugin to use the <a href="http://php.net/htmlspecialchars_decode">htmlspecialchars_decode</a> function to rid your install of this pesky escaping bug.
</p>]]></description>
      <pubDate>Thu, 11 Mar 2010 09:15:21 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: Mitigate the Security Risks of PHP System Command Execution]]></title>
      <guid>http://www.phpdeveloper.org/news/13934</guid>
      <link>http://www.phpdeveloper.org/news/13934</link>
      <description><![CDATA[<p>
PHPBuilder.com has a new article from <i>Jason Gilmore</i> on <a href="http://www.phpbuilder.com/columns/Jason_Gilmore012810.php3">security in command-line applications</a> posted today and what you can do to help protect your scripts from unwanted system command access.
</p>
<blockquote>
In this tutorial, I'll show you how to securely execute a variety of system-based commands via a PHP script, demonstrating how to build web applications that can tightly integrate with both the operating system and third-party software.
</blockquote>
<p>
He mentions the proper filtering of input strings (user input), how it can protect your and your application as well as a few examples of using the PHP execution functions (like <a href="http://php.net/exec">exec</a> or <a href="http://php.net/passthru">passthru</a>) and how to apply the shell escaping commands (like <a href="http://www.php.net/escapeshellarg">escapeshellarg</a>) as a first layer of security.
</p>]]></description>
      <pubDate>Fri, 29 Jan 2010 09:47:19 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: Stopping CodeIgniter from Escaping SQL]]></title>
      <guid>http://www.phpdeveloper.org/news/13930</guid>
      <link>http://www.phpdeveloper.org/news/13930</link>
      <description><![CDATA[<p>
In <a href="http://joind.in">a project</a> she's been working on <i>Lorna Mitchell</i> was frustrated with something the <a href="http://codeigniter.com">CodeIgniter</a> framework does natively - escape SQL statements done through the databaase layer's "select()" method. Thankfully, there was a simple fix to turn this behavior off.
</p>
<blockquote>
I've been getting increasingly impatient with its tendency to try to escape my SQL code for me - this is a really useful default feature but it seems to assume I don't know what I'm doing and so it puts backticks all over perfectly acceptable SQL code, very annoying!
</blockquote>
<p>
Thanks to <a href="http://twitter.com/damiangostomski/statuses/8209882657">a reply on twitter from damiangostomski</a> to her frustrations she found the optional second parameter you can give the "select()" method, a boolean that tells it whether or not to escape the query (it's mentioned <a href="http://codeigniter.com/user_guide/database/active_record.html#select">here</a>) for those that were wondering.
</p>]]></description>
      <pubDate>Thu, 28 Jan 2010 13:39:45 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Keith Casey's Blog: The First Rule for Software Development]]></title>
      <guid>http://www.phpdeveloper.org/news/12456</guid>
      <link>http://www.phpdeveloper.org/news/12456</link>
      <description><![CDATA[<p>
<i>Keith Casey</i> has <a href="http://caseysoftware.com/blog/the-first-rule-software-development">a suggestion</a> for budding (PHP) developers out there looking to jump head first into their first project: "Don't trust the users."
</p>
<blockquote>
Recently I taught a class of bright-eyed, bushy-tailed PHP'ers just getting their start in the world.  They haven't done their first production application and we were working in the "safe" confines of a classroom, but there was one concept that I pounded into their heads: Don't Trust the Users.
</blockquote>
<p>
Generally, as <i>Keith</i> mentions, users aren't malicious/incompetent/ignorant 99 percent of the time, but there's always that off chance that they are and you need to protect you and your application from it by <a href="http://shiflett.org/blog/2005/feb/my-top-two-php-security-practices">filtering input and escaping all output</a> to prevent any mishaps.
</p>]]></description>
      <pubDate>Tue, 05 May 2009 10:25:25 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[NETTUTS.com: Are You Making These 10 PHP Mistakes?]]></title>
      <guid>http://www.phpdeveloper.org/news/11877</guid>
      <link>http://www.phpdeveloper.org/news/11877</link>
      <description><![CDATA[<p>
All of you developers out there, NETTUTS.com has a question for you - are you making any of <a href="http://nettuts.com/articles/are-you-making-these-10-php-mistakes/">these ten PHP mistakes</a> in your day to day development? Which ones, you ask? Read on...
</p>
<blockquote>
Here are 10 PHP mistakes that any programmer, regardless of skill level, might make at any given time. Some of the mistakes are very basic, but trip up even the best PHP programmer. Other mistakes are hard to spot (even with strict error reporting). But all of these mistakes have one thing in common: They're easy to avoid.
</blockquote>
<p>Here's the list (as <i>Glen Stanberry</i> sees it):</p>
<ul>
<li>Single quotes, double quotes
<li>Semicolon after a While
<li>NOT Using database caching
<li>Missing Semicolon After a Break or a Continue
<li>Not Using E_ALL Reporting
<li>Not Setting Time Limits On PHP Scripts
<li>Not Protecting Session ID's
<li>Not Validating Cookie Data
<li>Not Escaping Entities
<li>Using Wrong Comparison Operators
</ul>]]></description>
      <pubDate>Wed, 04 Feb 2009 09:33:51 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Mark Kimsal's Blog: Addslashes(): don't call it a comeback]]></title>
      <guid>http://www.phpdeveloper.org/news/10401</guid>
      <link>http://www.phpdeveloper.org/news/10401</link>
      <description><![CDATA[<p>
As <i>Michael Kimsal</i> <a href="http://michaelkimsal.com/blog/php-addslashes-alternatives-comparison/">points out</a>, there's a <a href="http://cognifty.com/index.php/blog.entry/id=6/addslashes_dont_call_it_a_comeback.html">new posting</a> on his brother <i>Mark</i>'s blog talking about alternatives to addslashes() in your applications.
</p>
<blockquote>
I've seen a lot of people talking about mysql_real_escape_string() vs addslashes() vs addcslashes(). There seems to be a lot of real confusion about what these functions do (even with the php.net manual around), especially when it comes to character sets. [...] So, I've decided to lay it all out in a few charts so there is no confusion about what each function does and how each can help protect against SQL injection attacks.
</blockquote>
<p>
He <a href="http://cognifty.com/index.php/blog.entry/id=6/addslashes_dont_call_it_a_comeback.html">ran some tests</a> based on what the function does to see if it helps with certain things like "escapes with single quotes instead of backslash" and "prevents multi-byte attacks". He compares the speed and testability of the functions as well as provides a multi-byte breakdown oh how the mysql_real_escape_string function works with different character sets.
</p>]]></description>
      <pubDate>Thu, 12 Jun 2008 13:36:20 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Christopher Jones' Blog: PHP 5.3 "NOWDOCS" make SQL escaping easier]]></title>
      <guid>http://www.phpdeveloper.org/news/9633</guid>
      <link>http://www.phpdeveloper.org/news/9633</link>
      <description><![CDATA[<p>
<i>Christopher Jones</i> has <a href="http://blogs.oracle.com/opal/2008/02/13#a269">posted about</a> an update to the development for PHP 5.3 that makes escaping SQL even easier in scripts - NOWDOCS.
</p>
<blockquote>
Escaping quotes or other meta characters in SQL can be painful unless you get lucky with your quoting style. [...] Even with PHP's "Heredoc" syntax something will need escaping, but with PHP 5.3's new "Nowdoc" syntax no escaping is needed.
</blockquote>
<p>
The only difference between HEREDOC and NOWDOC is that the initial keyword (like the first END in this statement: <<<'END' text here END;) that can make worrying about complex quoting rules a thing of the past.
</p>]]></description>
      <pubDate>Thu, 14 Feb 2008 11:18:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen's Blog: A View Stream with Zend_View]]></title>
      <guid>http://www.phpdeveloper.org/news/9581</guid>
      <link>http://www.phpdeveloper.org/news/9581</link>
      <description><![CDATA[<p>
<i>Rob Allen</i> has <a href="http://akrabat.com/2008/02/05/a-view-stream-with-zend_view/">posted about</a> a small modification that he made to his Zend Framework setup that allows for a little safer echoing of information out to the View later of an application.
</p>
<blockquote>
One of my biggest issues with using PHP as the templating engine in View scripts is that the easiest way to echo a variable is the least secure. [...] So, I decided to leverage <a href="http://mikenaberezny.com/2006/02/19/symphony-templates-ruby-erb/">a post by Mike Naberezny</a> from a while ago about streams. The idea is all his; I just modified it to work with Zend Framework's Zend_View the way I wanted it to.
</blockquote>
<p>
His method uses a slightly different output format - instead of using a normal echo statement to push out the escaped output, it uses a special syntax using the "@" sign as a shortcut to the call to escape(). He includes the code you'll need to make it work in your ZF install and explain it a bit (including where the real key lies - in stream_popen). 
</p>]]></description>
      <pubDate>Thu, 07 Feb 2008 07:58:17 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Michael Girouard's Blog: FIEO with PHP 5 Interceptors]]></title>
      <guid>http://www.phpdeveloper.org/news/9001</guid>
      <link>http://www.phpdeveloper.org/news/9001</link>
      <description><![CDATA[<p>
<i>Michael Girouard</i> has a <a href="http://www.lovemikeg.com/blog/2007/10/30/feio-with-php-5-interceptors/">post on his blog</a> about something that's becoming more and more wide-spread in the PHP community (thankfully) - filtering input from users and escaping the output to ensure the safety of your application.
</p>
<blockquote>
The idea itself is simple. When data comes into your application, it must be filtered prior to it actually being used for any reason. This means all data. Form values, URL values, and yes, even the values in the forever useful $_SERVER superglobal. [...] Before leaving your application, data should be properly escaped with the specific output medium in mind. 
</blockquote>
<p>
<a href="http://www.lovemikeg.com/blog/2007/10/23/the-abstract-collection/">Previously</a> he showed how, using an interceptor method in PHP5, you could build "collections of data". He uses the same sort of method here, appling custom filters to the data based on the output call. Code is included for both the filtering interface and two example filters - one for SQL and the other for HTML.
</p>
<p>
You can also <a href="http://www.lovemikeg.com/downloads/DataFilter.php.txt">grab the code</a> if you just want to play with that.
</p>]]></description>
      <pubDate>Thu, 08 Nov 2007 08:41:00 -0600</pubDate>
    </item>
  </channel>
</rss>

