<?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>Sun, 07 Sep 2008 01:51:57 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Havard Eide's Blog:  SplObjectStorage]]></title>
      <guid>http://www.phpdeveloper.org/news/10662</guid>
      <link>http://www.phpdeveloper.org/news/10662</link>
      <description><![CDATA[<p>
<i>Havard Eide</i> has a <a href="http://eide.org/2008/07/21/splobjectstorage/">recent post</a> to his blog that looks at a part of the Standard PHP Library (SPL) that can be used with objects to store them for later use - SplObjectStorage.
</p>
<blockquote>
In this post I will look at SplObjectStorage: a container that allows to store objects uniquely without the need to compare them one by one.
</blockquote>
<p>
He lets the code to most of the talking, showing how to do the standard operations for a data store - adding objects (both unique and the same), updating objects in the store, checking to see if an object is already added and removing an object from storage.
</p>]]></description>
      <pubDate>Wed, 23 Jul 2008 08:47:44 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Brian Moon's Blog: in_array is quite slow]]></title>
      <guid>http://www.phpdeveloper.org/news/10357</guid>
      <link>http://www.phpdeveloper.org/news/10357</link>
      <description><![CDATA[<p>
<i>Brian Moon</i> had <a href="http://brian.moonspot.net/2008/06/05/in_array-is-quite-slow/">a problem</a> - one of his cron jobs was lasting for much longer (hours!) than it should have been. He tweaked, tested and debugged the script and finally came down to a call to <a href="http://www.php.net/in_array">in_array</a>, something he comments on as being "quite slow".
</p>
<blockquote>
See, this job is importing data from a huge XML file into MySQL.  After it is done, we want to compare the data we just added/updated to the data in the table so we can deactivate any data we did not update. [...] We then compared the two arrays by looping one array and using in_array() to check if the value was in the second array. [...] So, that was running for hours with about 400k items.  Our data did not contain the value as the key, but it could as the value was unique.  
</blockquote>
<p>
He method, replacing the in_array call that had to do a full array scan for each time through the loop with an isset/unset combo on the unique key, changed the execution time down from about 4 hours to 0.8 seconds.
</p>]]></description>
      <pubDate>Fri, 06 Jun 2008 09:36:47 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Internet Super Hero Blog: Is PDO::FETCH_UNIQUE broken by design?]]></title>
      <guid>http://www.phpdeveloper.org/news/9758</guid>
      <link>http://www.phpdeveloper.org/news/9758</link>
      <description><![CDATA[<p>
On the Internet Super Hero blog, there's a <a href="http://blog.ulf-wendel.de/?p=179">post</a> that looks at how PDO is implemented in PHP and wonders if the PDO::FETCH_UNIQUE constant is broken (as something to fix before even considering the move to PDO2).
</p>
<blockquote>
I spent quite a lot of time comparing the different behaviours of the various drivers in the hope I could find out how PDO drivers are supposed to work. The PDO documentation and the specification do not cover each and every detail. PDO really needs some love...
</blockquote>
<p>
He picks out the FETCH_UNIQUE constant as one that needs a little work and tries to track down exactly what it's doing. One issue he found was that it requires combination with other flags to make the unique part of it work correctly (like FETCH_OBJ or FETCH_COLUMN). He works through several examples, both ones that apply the unique call and others that don't, comparing the results.
</p>]]></description>
      <pubDate>Fri, 07 Mar 2008 10:25:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Sebastian Bergmann's Blog: Distributed Testing with PHPUnit 3.1]]></title>
      <guid>http://www.phpdeveloper.org/news/7331</guid>
      <link>http://www.phpdeveloper.org/news/7331</link>
      <description><![CDATA[<p>
In his latest post, <i>Sebastian Bergmann</i> <a href="http://sebastian-bergmann.de/archives/659-Distributed-Testing-with-PHPUnit-3.1.html">spotlights another new feature</a> of the upcoming <a href="http://www.phpunit.de/">PHPUnit</a> release - distributed testing.
</p>
<blockquote>
One of the new features in the upcoming <a href="http://www.phpunit.de/">PHPUnit 3.1</a> release is the support for distributed testing through the ability to log test result and code coverage data to a database. This way, the same test suite can be run on different platforms with the results being aggregated in the database. For this to work, however, we need a key in the database that identifies test runs from different machines as being related. A <a href="http://subversion.tigris.org/">Subversion</a> revision number is a perfect candidate for this.
</blockquote>
<p>
He <a href="http://sebastian-bergmann.de/archives/659-Distributed-Testing-with-PHPUnit-3.1.html">includes a sample script</a> that helps with the storage of the results in the database by grabbing a unique id for the machine pushing the updates in.
</p>]]></description>
      <pubDate>Thu, 22 Feb 2007 12:14:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[JSLabs Blog:  How to stop IE from caching AJAX requests]]></title>
      <guid>http://www.phpdeveloper.org/news/7217</guid>
      <link>http://www.phpdeveloper.org/news/7217</link>
      <description><![CDATA[<p>
If you've ever had the frustration of working with Ajax in Internet Explorer and have noticed it caching the requests/results, you might want to check out <a href="http://www.whenpenguinsattack.com/2007/02/05/how-to-stop-ie-from-caching-ajax-requests/">this new post</a> on the JSLabs blog for a helpful hint.
</p>
<blockquote>
While working on an AJAX project over the weekend, I ran into the following issue: (through a GET request), every time I tried to call a certain function, It was returning the same data (which was supposed to be different each time)
</blockquote>
<p>
First, he tried just changing the headers (via PHP's header function) to see if IE would understand the new message, but to no avail. He finally figured out that, despite whatever headers were sent or how much the content changed, what he really needed to do was to provide the script some kind of unique identifier with each request (just appended to the url) so that IE knew the request was different. His weapon of choice was a date/time value.
</p>]]></description>
      <pubDate>Mon, 05 Feb 2007 08:05:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[The Bakery: Checking for duplicate records (unique record)]]></title>
      <guid>http://www.phpdeveloper.org/news/7154</guid>
      <link>http://www.phpdeveloper.org/news/7154</link>
      <description><![CDATA[<p>
On The Bakery, there's a new <a href="http://bakery.cakephp.org/articles/view/189">expanded tutorial</a> (from <a href="http://wiki.cakephp.org/tutorials:duplicate_record_validation">this</a>) that talks about how to check for duplicate records in your CakePHP model.
</p>
<blockquote>
[Here's how to] validate a form field (such as a user name field), both in add and edit form and make sure that the selected user name does not already exist in the database [via a] function repeated only once (in app/app_model.php).
</blockquote>
<p>
The <a href="http://bakery.cakephp.org/articles/view/189">example model</a> they give defines an isUnique method that essentially runs an automatic check (a count() call) on the table to see if the given information exists. The example Model, View, and Controller are all given.
</p>]]></description>
      <pubDate>Tue, 23 Jan 2007 15:33:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[WebCheatSheet.com: Secure File Upload with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/7122</guid>
      <link>http://www.phpdeveloper.org/news/7122</link>
      <description><![CDATA[<p>
A <a href="http://www.webcheatsheet.com/php/file_upload.php">new tutorial</a> has been posted to the WebCheatSheet.com website demonstrating a method for secure file uploads with PHP.
</p>
<blockquote>
In spite of security issues that should be addressed before enabling file uploads, the actual mechanisms to allow this are straight forward. In this tutorial we will consider how to upload files to some directory on your Web server. We will also discuss security issues concerned with the file uploading.
</blockquote>
<p>
They <a href="http://www.webcheatsheet.com/php/file_upload.php">break it up</a> into the two key parts - the HTML form and the PHP script that handles the resulting upload request. The "secure" part comes in with the validation of the upload. In this case, making sure it's a JPEG file, that its size is less than 350 KB, and that a file by that name doesn't already exist.
</p>]]></description>
      <pubDate>Thu, 18 Jan 2007 11:40:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Felix Geisendorfer's Blog: Handling inline links to dynamic resources]]></title>
      <guid>http://www.phpdeveloper.org/news/6664</guid>
      <link>http://www.phpdeveloper.org/news/6664</link>
      <description><![CDATA[<p>
On the ThinkingPHP Blog today, there's <a href="http://www.thinkingphp.org/2006/11/06/handling-inline-links-to-dynamic-resources/">a look at</a> how to handle inline links to dynamic resources - specifically allowing users to create links in their own content to dynamic content elsewhere on the site.
</p>
<blockquote>
I thought of something that would be both, easy to implement and easy to use. What I finally came up with is tightly coupled to my <a href="http://www.thinkingphp.org/2006/09/18/dessert-11-welcome-back-friendly-urls/">new url system</a> that I'm using, so make sure to <a href="http://www.thinkingphp.org/2006/09/18/dessert-11-welcome-back-friendly-urls/">check it out</a> in case you've missed it.
</blockquote>
<p>
The basic idea of the system is that the URL of the page (made up partly of the title) would be the unique identifier for the page. For example, "[page 12]" would be expanded out to "/pages/12:my-title". <i>Felix</i> takes this idea and runs with it, showing how to implement it in a CakePHP project inside of a Model and a Component. The sample usage code is, of course, also included in <a href="http://www.thinkingphp.org/2006/11/06/handling-inline-links-to-dynamic-resources/">the post</a>.
</p>]]></description>
      <pubDate>Wed, 08 Nov 2006 07:21:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Hiveminds Magazine: Using numbers in PHP function names]]></title>
      <guid>http://www.phpdeveloper.org/news/5392</guid>
      <link>http://www.phpdeveloper.org/news/5392</link>
      <description><![CDATA[<p>
In PHP, function names have to start with either an underscore or some alpha-numeric character. Most developers, however, choose just the underscore (more recently, especially in PHP5 applications) and an alphabet character - no numbers. In <a href="http://www.hiveminds.co.uk/using-numbers-in-php-function-names">this new post</a> from Hiveminds magazine, hoever, they suggest a different approach to naming conventions for your functions/methods.
</p>
<quote>
<i>
<p>
There is a problem with using procedural code in PHP. If you have hundreds of functions then you are going to run into naming problems after a while. In PHP function names not protected by OOP classes have to have unique names. This is no problem if you are not using a hook system like that of Wordpress or Drupal. These CMS are coded using the underscore character as a designation for a hook system. This "hook_action" is an example. 
</p>
<p>
Well as the project grows and becomes more popular then you start running out of humanly understandble words and letters to use. That or the names become too long to be remembered during normal development. So why don't developers use numbers in the name of their functions?
</p>
</i>
</quote>
<p>
The author <a href="http://www.hiveminds.co.uk/using-numbers-in-php-function-names">suggests</a> that numbers can be more memorable than just named functions and can even help to seperate them into a kind of namespace within the application. There's a bit of code that shows how to, with his naming convention ("tying the knot"), check to see if a module implements a hook.
</p>
<p>
He also notes how using <a href="http://www.hiveminds.co.uk/using-numbers-in-php-function-names">a system like this</a> can help run your code of those pesky conflicts between function names that can happen when integrating 3rd party applications.
</p>]]></description>
      <pubDate>Thu, 18 May 2006 06:14:59 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ben Ramsey's Blog: Peruser MPM for Apache]]></title>
      <guid>http://www.phpdeveloper.org/news/4407</guid>
      <link>http://www.phpdeveloper.org/news/4407</link>
      <description><![CDATA[In his quest for a secure method of server-side security in addition to PHP, <i>Ben Ramsey</i> stumbled across <a href="http://www.telana.com/peruser.php">Peruser MPM</a>, an Apache security module, seemingly with PHP in mind. In <a href="http://benramsey.com/archives/peruser-mpm-for-apache/">this latest blog post</a> he details what lead him there.
<p>
<quote>
<i>
A while back, when I was doing some research for a talk on server-side security for PHP, I looked into various "secure" methods for setting up a server for multiple users. Despite my search, I couldn't find a simple and effective solution for managing a server with a large (and untrusted) user base (as is the case with many virtual hosting companies).
<p>
Sure, there's PHP's safe_mode, but its "safety" is misleading at best. There's also open_basedir, which helps a little, but it's not quite enough. For my research, I also looked at and tested <a href="http://www.modsecurity.org/">mod_security</a>, and the <a href="http://www.hardened-php.net/">Hardened PHP Project's Hardening Patch</a>.
</i>
</quote>
<p>
Eventually, through <a href="http://www.christopher-kunz.de/serendipity/archives/74-guid.html#c533">this comment</a>, he found <a href="http://www.telana.com/peruser.php">Peruser MPM</a>, a module that runs each Apache process with its own user/group combination. He <a href="http://benramsey.com/archives/peruser-mpm-for-apache/">notes a few issues</a> that it still has (breaking mod_ssl and making Apache less scalable), but overall, it does sound pretty cool... ]]></description>
      <pubDate>Thu, 01 Dec 2005 07:12:35 -0600</pubDate>
    </item>
  </channel>
</rss>
