<?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 10:46:54 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Lukas Smith's Blog: Query parameter handling in Symfony2]]></title>
      <guid>http://www.phpdeveloper.org/news/17954</guid>
      <link>http://www.phpdeveloper.org/news/17954</link>
      <description><![CDATA[<p>
<i>Lukas Smith</i> is <a href="http://pooteeweet.org/blog/0/2096#m2096">looking for feedback</a> about a question that's been in his mind a lot lately - can the handling of query parameters be made better for the <a href="http://symfony.com">Symfony2</a> framework (and even easier to use).
</p>
<blockquote>
Obviously you can already access query parameters today already but it could be easier. Essentially what I want is a way for developers to easily configure what query parameters they expect and what values they expect. This is useful for several things like easier reading and validating of query parameters, self documenting API both for <a href="https://github.com/nelmio/NelmioApiDocBundle">API docs</a> for humans but also <a href="https://github.com/FriendsOfSymfony/FOSRestBundle/issues/52">for machines</a>.
</blockquote>
<p>
He's asking for feedback and ideas from the community on a <a href="https://github.com/FriendsOfSymfony/FOSRestBundle/pull/185">proposed solution</a> that could make things more flexible. He also briefly mentions the route matching and how qurey parameters could cause them not to match:
</p>
<blockquote>
For one I don't think that a mismatch on a <a href="http://symfony.com/doc/master/book/routing.html#adding-requirements">route requirement</a> of a query parameter cause the route to not match. However then it can quickly become confusing for the end user or it would require adding more and more syntax to handle all the different cases.
</blockquote>]]></description>
      <pubDate>Mon, 14 May 2012 11:56:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Larry Garfield's Blog: readfile() not considered harmful]]></title>
      <guid>http://www.phpdeveloper.org/news/17909</guid>
      <link>http://www.phpdeveloper.org/news/17909</link>
      <description><![CDATA[<p>
In <a href="http://www.garfieldtech.com/blog/readfile-memory">this new post</a> to his blog <i>Larry Garfield</i> tries to dispel a common misconception in the PHP development world - that the <a href="http://php.net/readfile">readfile</a> function should be considered harmful and can cause memory issues in your code.
</p>
<blockquote>
If you're like me, you've probably read a dozen or two articles about PHP performance in your career. Many of them are quite good, but some are simply flat out wrong, or misinformed. One of the old truisms that has been repeated for as long as I can recall is "don't use readfile() if you have big files, because it reads the whole file into memory and your server will explode." [...] There's just one problem with that age-old truism: It's not true.
</blockquote>
<p>
He created some benchmarks to illustrate the differences between several of the common methods for working with files via the <a href="http://php.net/fread">fread</a>, <a href="http://php.net/fpassthru">fpassthru</a>, <a href="http://php.net/stream_copy_to_stream">stream_copy_to_stream</a> and of course <a href="http://php.net/readfile">readfile</a>. He reports the results based on the runtime and the peak memory usage and noted, ironically, that while the times varied slightly, the memory consumption was exactly the same for all of the approaches. Since there's no real reason not to use "readfile", he looks at three reasons why there might be this stigma attached to it (including the issues that could come up with output buffering enabled).
</p>]]></description>
      <pubDate>Fri, 04 May 2012 09:51:38 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHP.net: PHP 5.3.12 and PHP 5.4.2 Released!]]></title>
      <guid>http://www.phpdeveloper.org/news/17907</guid>
      <link>http://www.phpdeveloper.org/news/17907</link>
      <description><![CDATA[<p>
The PHP project has <a href="http://www.php.net/archive/2012.php#id2012-05-03-1">officially released the latest versions</a> in both the 5.3.x and 5.4.x series in response to a bug that was found in the CGI setup of certain server+PHP configurations.
</p>
<blockquote>
<p>
There is a vulnerability in certain CGI-based setups (Apache+mod_php and nginx+php-fpm are not affected) that has gone unnoticed for at least 8 years. Section 7 of the CGI spec states: 'Some systems support a method for supplying a [sic] array of strings to the CGI script. This is only used in the case of an `indexed' query. This is identified by a "GET" or "HEAD" HTTP request with a URL search string not containing any unencoded "=" characters.'
</p>
<p>
A large number of sites run PHP as either an Apache module through mod_php or using php-fpm under nginx. Neither of these setups are vulnerable to this. Straight shebang-style CGI also does not appear to be vulnerable. If you are using Apache mod_cgi to run PHP you may be vulnerable. To see if you are, just add ?-s to the end of any of your URLs. If you see your source code, you are vulnerable. If your site renders normally, you are not.
</p>
</blockquote>
<p>
You can download this latest version from <a href="http://www.php.net/downloads.php">the downloads page</a> for the source releases or <a href="http://windows.php.net">windows.php.net</a> for the Windows binaries. You can look at <a href="http://www.php.net/ChangeLog-5.php#5.4.2">the Changelog</a> if you'd like more details on the update.
</p>]]></description>
      <pubDate>Fri, 04 May 2012 07:19:08 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPBuilder.com: Error Handling in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/17641</guid>
      <link>http://www.phpdeveloper.org/news/17641</link>
      <description><![CDATA[<p>
New on PHPBuilder.com today <i>Leidago Noabeb</i> gives you a <a href="http://www.phpbuilder.com/columns//php-error-handling/Leidago_Noabeb03062012.php3">pretty comprehensive overview</a> of error handling in PHP - everything from the types of errors to how to control which are output in which environments.
</p>
<blockquote>
In this article we will be looking at how to handle errors in PHP. Errors are an inevitable part of software development, and accordingly, we will be looking at the various error types and demonstrating how to handle them. If you intend to run any of the sample scripts in this article, please make sure that display errors is turned on in your PHP initialization document (php.ini).
</blockquote>
<p>
The article talks about the types of errors PHP uses (syntactical, runtime and logical) and shows how to handle some of the most common issues with them. It also talks about the different error reporting levels (ex. E_ALL, E_WARNING, E_STRICT) and includes the code for a simple error handler class that switches off and handles each type differently.
</p>]]></description>
      <pubDate>Wed, 07 Mar 2012 13:37:12 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Bas De Nooijer's Blog: Benchmarking PHP Solr response data handling]]></title>
      <guid>http://www.phpdeveloper.org/news/17617</guid>
      <link>http://www.phpdeveloper.org/news/17617</link>
      <description><![CDATA[<p>
On his blog <i>Bas De Nooijer</i> has put together <a href="http://www.raspberry.nl/2012/02/28/benchmarking-php-solr-response-data-handling/">some PHP Solr benchmarks</a> around a few different ways to handle the response data.
</p>
<blockquote>
Solr supports multiple output formats. Some are for general use (xml, json) and some are even language specific. If you're using PHP these are the most logical response writer formats: xml, json, phps (serialized php), php (php code to execute). On top of that PHP offers multiple ways to parse XML. I'm benchmarking these options to determine the most efficient decoding to implement in the next major version of <a href="http://www.solarium-project.org/">Solarium</a>, but the results should be useful for any PHP Solr implementation.
</blockquote>
<p>
He includes a snippet of code he's using to generate the benchmarks, a PHPUnit test that pulls in two different json-based results and, for now, just runs a <a href="http://php.net/json_decode">json_decode</a> on it. You can see the results of his testing <a href="http://www.raspberry.nl/files/solr-decode-performance.html">here</a>, graphing out the different response handling methods and their time (in milliseconds) to parse the response. It's interesting to see that there's a direct relation to the size of the data set and how long it takes for the methods to execute.
</p>
<p>
The current code for his benchmarks is available <a href="https://github.com/basdenooijer/phperf">over on github</a>
</p>]]></description>
      <pubDate>Fri, 02 Mar 2012 09:08:03 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Derick Rethans' Blog: To GMT or not to GMT]]></title>
      <guid>http://www.phpdeveloper.org/news/17611</guid>
      <link>http://www.phpdeveloper.org/news/17611</link>
      <description><![CDATA[<p>
In <a href="http://derickrethans.nl/gmt-being-tricky.html">this new post</a> to his site, <i>Derick Rethans</i> shows an instance of "GMT being tricky" when it comes to "UTC" versus "GMT" output from PHP's DateTime object.
</p>
<blockquote>
Earlier today, on twitter, @skoop asked: "dear #lazyweb, when I use DateTimeZone('GMT'), why does format('e') output UTC?" [...] As you can see [the example with a format of "e" on a DateTimeZone('GMT')] has UTC and not GMT as you might expect.
</blockquote>
<p>
<i>Derick</i> mentions that sometimes, systems require "GMT" instead of "UTC" in the output they're given. To work around this issue, he shows how to add a "type 2" timezone to the DateTime object by including it when you initialize the object (code samples included). Using alternative methods, you can add these "type 2" timezones in three ways - an offset in the initial string, using the abbreviation (like "EST" or "PST") and specifying the long version of the timezone (like "America/Montreal").
</p>]]></description>
      <pubDate>Thu, 01 Mar 2012 11:39:45 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: String Handling Functions]]></title>
      <guid>http://www.phpdeveloper.org/news/17304</guid>
      <link>http://www.phpdeveloper.org/news/17304</link>
      <description><![CDATA[<p>
On PHPMaster.com today <i>James Appleyard</i> has put tother a tutorial for the beginners out there about <a href="http://phpmaster.com/string-handling-functions/">working with strings in PHP</a>, using the huge list of built-in functions to work with your values.
</p>
<blockquote>
PHP has a vast selection of built-in string handling functions that allow you to easily manipulate strings in almost any possible way. [...]  There is no way I can cover every string function in one article, and besides, that is what the PHP manual is for! But what I will do is show how to work with some of the most commonly used string handling functions that you should know. After this, you'll be working with strings as well as any concert violinist!
</blockquote>
<p>
He shows how to use functions to: change the case of string, remove extra whitespace, get the length, slicing them up and doing replacing on some certain characters. You can find more information on these and the complete list of string functions in PHP in <a href="http://us2.php.net/strings">the manual</a>.
</p>]]></description>
      <pubDate>Mon, 26 Dec 2011 15:38:56 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Chris Hartjes' Blog: Better HTTP Request/Response in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17256</guid>
      <link>http://www.phpdeveloper.org/news/17256</link>
      <description><![CDATA[<p>
In a recent post to his blog <i>Chris Hartjes</i> looks at the idea of <a href="http://www.littlehart.net/atthekeyboard/2012/12/12/better-http-request-response-in-php/">better HTTP Request/Response functionality</a> in PHP, more than just the <a href="http://us3.php.net/manual/en/language.variables.superglobals.php">superglobal</a> handling and <a href="http://www.php.net/http">PECL HTTP extension</a> it has now.
</p>
<blockquote>
I think the fact that we have $_POST and $_GET lulls some of us into the false sense that we should have $_PUT and $_DELETE objects, since that would map to the commonly-desired set of HTTP verbs that REST likes to use. But what should be inside those things, or should we be moving towards a more Pythonesque solution where a Request object, as part of core or via a only-really-for-the-brave- PECL extension?
</blockquote>
<p>
He mentions opinions from other PHP community members (<a href="http://twitter.com/lxt">Laura Thompson</a> and <a href="http://twitter.com./auroraeosrose">Elizabeth Smith</a>) and a bit about what he (and I'm sure other developers) are looking for in a more full-featured request/response handling feature.
</p>]]></description>
      <pubDate>Wed, 14 Dec 2011 09:51:03 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Handling File Data with PHP (Reading & Seeking)]]></title>
      <guid>http://www.phpdeveloper.org/news/17196</guid>
      <link>http://www.phpdeveloper.org/news/17196</link>
      <description><![CDATA[<p>
DevShed has posted the fifth part of their "handling files in PHP" tutorial series today (excerpted from the book "Beginning PHP and PostgreSQL 8: From Novice to Professional") with a focus on <a href="http://www.devshed.com/c/a/PHP/Handling-File-Data-with-PHP/">read from multiple places in a file</a> to get to different data.
</p>
<blockquote>
In this fifth part of an eight-part series on working with file and operating systems with PHP, you'll learn how to read data from a file and move the file pointer. 
</blockquote>
<p>
Example code is included showing how to use the <a href="http://php.net/file">file</a>, <a href="http://php.net/file_get_contents">file_get_contents</a>, <a href="http://php.net/fgetc">fgetc</a>, <a href="http://php.net/fgetcsv">fgetcsv</a>, <a href="http://php.net/readfile">readfile</a> and <a href="http://php.net/fscanf">fscanf</a> (among several others). Also included is code showing how to use the <a href="http://php.net/fseek">fseek</a> method to move around in a file.
</p>]]></description>
      <pubDate>Thu, 01 Dec 2011 10:09:14 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: Handling SQL Errors in PDO]]></title>
      <guid>http://www.phpdeveloper.org/news/17134</guid>
      <link>http://www.phpdeveloper.org/news/17134</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> has a quick new post showing one way to <a href="http://www.lornajane.net/posts/2011/handling-sql-errors-in-pdo">handle SQL errors in PDO</a> that could pop up because of badly written/generated SQL statements.
</p>
<blockquote>
I love <a href="http://php.net/pdo">PHP's PDO (PHP Data Objects)</a> extension; it gives a consistent, object-oriented interface to handling all kinds of relational database backends. One thing that annoys me is that the MySQL driver for PDO defaults to a silent error mode which can make SQL errors tricky to spot!
</blockquote>
<p>
In her two code snippets she shows a failing PDO request (that fails silently) and a method for catching this issue - checking the result of the "<a href="http://us2.php.net/manual/en/pdo.errorcode.php">errorCode</a>" method to see if it equals "0" (zero). If there were errors, you can use the "<a href="http://us2.php.net/manual/en/pdo.errorinfo.php">errorInfo</a>" function to get to them. This will return the SQL error code, the driver-specific error code and a driver-specific error message.
</p>]]></description>
      <pubDate>Wed, 16 Nov 2011 09:43:34 -0600</pubDate>
    </item>
  </channel>
</rss>

