<?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, 22 May 2013 23:17:49 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Reddit.com: Year Old Bug Request for $_PUT Interested in /r/php's Opinion]]></title>
      <guid>http://www.phpdeveloper.org/news/18645</guid>
      <link>http://www.phpdeveloper.org/news/18645</link>
      <description><![CDATA[<p>
A discussion has started up on Reddit.com about the <a href="http://www.reddit.com/r/PHP/comments/11uczq/year_old_bug_request_for_put_interested_in_rphps/">request for a "$_PUT" superglobal</a> to match the already existing "$_POST" and "$_GET" (as is mentioned in <a href="https://bugs.php.net/bug.php?id=55815">this bug</a>).
</p>
<blockquote>
Data that is posted to PHP via the PUT method is not parsed at all and is not 
available to PHP. This is particularly problematic for data sent encoded as 'multipart/form-data'. [...] This is something that would help every RESTful interface that people are trying to do with PHP. There are many people who have these problems and have to implement (usually incomplete and/or buggy) PHP solutions.
</blockquote>
<p>
In the <a href="http://www.reddit.com/r/PHP/comments/11uczq/year_old_bug_request_for_put_interested_in_rphps/">Reddit post</a> there's a mixed set of opinions - some say that things work well enough as is (content pulled from the raw stream) and others say that adding something like this makes the HTTP support more complete and functional.
</p>]]></description>
      <pubDate>Tue, 23 Oct 2012 09:48:12 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Introducing Superglobals]]></title>
      <guid>http://www.phpdeveloper.org/news/16931</guid>
      <link>http://www.phpdeveloper.org/news/16931</link>
      <description><![CDATA[<p>
PHPMaster.com is back with another introductory tutorial for those new to the PHP language. It's a look at one of the most commonly used (sometimes badly) features of the language - <a href="http://phpmaster.com/introducin-superglobals/">superglobal variables</a>.
</p>
<blockquote>
Superglobals are specially-defined array variables in PHP that make it easy for you to get information about a request or its context. They are called superglobal because they are always accessible, regardless of the scope - that is, you can access them from any function, class or file without having to do anything special. The superglobal variables are: $GLOBALS, $_SERVER, $_GET, $_POST, $_FILES, $_COOKIE, $_SESSION, $_REQUEST and $_ENV. And while you can learn more about each by reading the <a href="http://www.php.net/language.variables.superglobals.php">PHP documentation</a>, I'd like to show you the ones I think you're likely use the most.
</blockquote>
<p>
He goes through some of the major ones and explains what kind of situations they can be used in and what data would be inside - $_POST, $_GET, $_SESSION and $_SERVER.
</p>]]></description>
      <pubDate>Fri, 30 Sep 2011 08:43:43 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[php|architect: Never Use $_GET Again ]]></title>
      <guid>http://www.phpdeveloper.org/news/14769</guid>
      <link>http://www.phpdeveloper.org/news/14769</link>
      <description><![CDATA[<p>
In <a href="http://www.phparch.com/2010/07/08/never-use-_get-again">this new post</a> to the php|architect blog <i>Matt Butcher</i> offers a security tip for all PHP developers out there - never use $_GET again.
</p>
<blockquote>
You don't need to use $_GET or $_POST anymore. In fact, you probably shouldn't use $_GET and $_POST  anymore. Since PHP 5.2, there is a new and better way to safely retrieve user-submitted data. [...] Rather than accessing the $_GET and $_POST superglobals directly, you can make use of PHP functions like filter_input()  and filter_input_array().
</blockquote>
<p>
He gives a code example of it in use and talks about the two things these functions do to help keep you safe - validate the data for correct match on criteria and sanitizing the value to ensure the return value is only what's requested. You can find more about these filter functions in the <a href="http://us.php.net/manual/en/ref.filter.php">Filters</a> section of the PHP manual.
</p>]]></description>
      <pubDate>Fri, 09 Jul 2010 09:15:48 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Cleaning up Array Elements, POST and GET Requests with Filters in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/13199</guid>
      <link>http://www.phpdeveloper.org/news/13199</link>
      <description><![CDATA[<p>
DevShed has posted <a href="http://www.devshed.com/c/a/PHP/Cleaning-up-Array-Elements-POST-and-GET-Requests-with-Filters-in-PHP-5/?kc=rss">the last article</a> in their series on filtering input (from whatever source) in your PHP application. This time the focus is on cleaning up the GET and POST superglobals.
</p>
<blockquote>
The <a href="http://php.net/filter">[filter] library</a> is also capable of cleaning up strings in arrays, as well in data coming from GET and POST requests and cookies. Therefore, this final article of the series will demonstrate how to do this with a few understandable examples, in this manner concluding this quick introduction to working with the PHP 5 filter library.
</blockquote>
<p>
They <a href="http://www.devshed.com/c/a/PHP/Cleaning-up-Array-Elements-POST-and-GET-Requests-with-Filters-in-PHP-5/2/">show how to use</a> each of the constants referring to these superglobals (INPUT_GET, INPUT_POST, INPUT_REQUEST, etc) to run through each of the values and check them against another filter.
</p>]]></description>
      <pubDate>Thu, 10 Sep 2009 09:48:07 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Brandon Savage's Blog: Superglobals In Classes: Revisited]]></title>
      <guid>http://www.phpdeveloper.org/news/12865</guid>
      <link>http://www.phpdeveloper.org/news/12865</link>
      <description><![CDATA[<p>
Revisiting an <a href="http://www.phpdeveloper.org/news/11521">earlier post</a> dealing with superglobals and classes, <i>Brandon Savage</i> <a href="http://www.brandonsavage.net/superglobals-in-classes-revisited/">looks at an example</a> of why its still a bad idea.
</p>
<blockquote>
I asserted at the time that superglobals inside of a class violated some basic rules on what a class was supposed to do. Today, I am revisiting that discussion. The placement of superglobals inside a class creates an impossible situation for code reuse. [...] Ehat happens when we want to move this [code] to another site? Unless we leave our form fields named [the same] we'll have to modify the original code.
</blockquote>
<p>
His alternative - a much better refactoring - lets the verifyCredentials method take in the username and password and has the calling script define where those come from, either from a local or global location.
</p>]]></description>
      <pubDate>Tue, 14 Jul 2009 07:51:11 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: The ABC's of PHP Part 4 - How Variable Am I?]]></title>
      <guid>http://www.phpdeveloper.org/news/12260</guid>
      <link>http://www.phpdeveloper.org/news/12260</link>
      <description><![CDATA[<p>
PHPBuilder.com has the next articles in their "ABCs of PHP" series posted today, a <a href="http://www.phpbuilder.com/columns/peter_shaw04012009.php3">look at variables</a> - what they are and how they're used.
</p>
<blockquote>
To many beginners the subject of variables is usually pretty scary, and often a reasonably difficult concept to grasp, the reason for this however is usually because most modern languages require some kind of indication as to what type of data a variable will hold, this in turn often confuses beginners because they don't know what type of data relates to what kind of type. 
</blockquote>
<p>
They describe variables (using sample assignments like strings and numbers) and talk some about scope and how it affects their visibility. There's also a brief mention of the superglobals there close to the end.
</p>]]></description>
      <pubDate>Thu, 02 Apr 2009 07:51:36 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Stefan Esser's Blog: Some facts about the PHPList vulnerability and the phpbb.com hack]]></title>
      <guid>http://www.phpdeveloper.org/news/11897</guid>
      <link>http://www.phpdeveloper.org/news/11897</link>
      <description><![CDATA[<p>
Some of you might have <a href="http://www.phpdeveloper.org/news/11868">heard about</a> the hacking of the phpBB.com website earlier this week. Well, <i>Stefan Esser</i> has <a href="http://www.suspekt.org/2009/02/06/some-facts-about-the-phplist-vulnerability-and-the-phpbbcom-hack/">posted a bit more</a> about the vulnerability in the PHPList software that lead to the problem.
</p>
<blockquote>
A few days ago <a href="http://www.phpbb.com/">phpbb.com</a> was hacked through a super-globals-overwrite vulnerability in <a href="http://www.phplist.com/">PHPList</a> that was used by an attacker for a local file inclusion <a href="http://www.milw0rm.com/exploits/7778">exploit</a>. Details about the whole attack, written down by someone who claims to be the attacker, can be <a href="http://hackedphpbb.blogspot.com/2009/01/place-holder.html">read here</a>.
</blockquote>
<p>
<i>Stefan</i> talks about the superglobal problem PHPList had - allowing the superglobal information to overwrite the variables inside the script without so much as a check. Example code shows how it was possible for the attacker to provide their own configuration file value to be opened via a stream wrapper.
</p>]]></description>
      <pubDate>Fri, 06 Feb 2009 08:44:25 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[SitePoint PHP Blog: On $_GET and $_POST]]></title>
      <guid>http://www.phpdeveloper.org/news/11890</guid>
      <link>http://www.phpdeveloper.org/news/11890</link>
      <description><![CDATA[<p>
On the SitePoint PHP Blog today <i>Troels Knak-Nielsen</i> <A href="http://www.sitepoint.com/blogs/2009/02/05/on-get-and-post/">takes a deeper look</a> at two of the superglobals a lot of PHP developers take for granted - $_GET and $_POST.
</p>
<blockquote>
When a PHP script is invoked by a web server, it is as the result of a HTTP request. A <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5">HTTP request</a> has a target URI and that URI consists of different parts. One of these parts is the query. As the PHP process starts up, the query gets parsed into an associative array. And for some reason, somebody decided on the unfortunate $_GET, because it's what you use for GET requests - right? Wrong!
</blockquote>
<p>
He points out that all HTTP requests, regardless if they're GET or POST will have that GET information (not necessarily in $_GET, though). He also mentions another commonly used (and sometimes abused) superglobal - $_FILES. His biggest gripe, though, is that the naming of the variables confuses the developer as to the true content of the HTTP request.
</p>
<blockquote>
And I won't even comment on the nastiness of $_REQUEST.
</blockquote>]]></description>
      <pubDate>Thu, 05 Feb 2009 11:14:33 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: How to Upload Images Using PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/11856</guid>
      <link>http://www.phpdeveloper.org/news/11856</link>
      <description><![CDATA[<p>
The PHPBuilder.com site has a <a href="http://www.phpbuilder.com/columns/bokeh20090129.php3">quick new tutorial</a> showing how to upload images to your server via a PHP script (including some error checking).
</p>
<blockquote>
One of the most frequently asked questions about PHP is "how can I use PHP to upload an image". In this article we'll discuss the details of how you can do just that!
</blockquote>
<p>
Their script is done in three steps - an HTML form to accept the input, the PHP script to handle the upload (working with the $_FILES superglobal) and another HTML page to let the user know their upload was a success. When the file is uploaded, they check for a few things: the internal error PHP could throw, ensuring that the uploaded file exists and checking to ensure that the file is an image. Only then is it moved over to the true uploads directory to be stored.
</p>]]></description>
      <pubDate>Mon, 02 Feb 2009 10:23:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Brandon Savage's Blog: Keeping Superglobals Out Of Classes]]></title>
      <guid>http://www.phpdeveloper.org/news/11521</guid>
      <link>http://www.phpdeveloper.org/news/11521</link>
      <description><![CDATA[<p>
In a <a href="http://www.brandonsavage.net/entry/keeping-superglobals-out-of-classes.html">new post</a> to his blog, <i>Brandon Savage</i> makes a suggestion that could help in maintenance and debugging down the road - keep those superglobals out of your classes.
</p>
<blockquote>
Let's ignore the security implications of the above code for just a moment, and focus on just the use of the superglobal. By using the $_POST superglobal array, we're effectively doing two things [in the example code]: relying on the field names and limiting code reuse.
</blockquote>
<p>
He shows how to refactor the example into something a bit more reusable by changing the method call to pass in the given username and password instead of looking to the global for it. He does note, however, that there are some more correct uses for those superglobals:
</p>
<blockquote>
There are some legitimate uses of superglobals in classes. One example is the use of the $_SESSION superglobal, which is often used for things like a user object. But I urge you to do so sparingly, when appropriate, rather than relying heavily on superglobals which are subject to change and may not give you the data you expect.
</blockquote>]]></description>
      <pubDate>Mon, 08 Dec 2008 07:57:24 -0600</pubDate>
    </item>
  </channel>
</rss>
