In this quick post to his blog Matthew Turland shares a "kink" he found in using the FilterIteractor SPL iterator when working with the Phergie project's code.Once I discovered the segfault [from the FilterIterator code], I had to come up with a short code sample exposing the bug in order to report it.He talks about the bug that led him to the segfault and a second bug that was a side effect of the first causing the first element to be skipped during iteration.
Jani Hartikainen has a few suggestions on how to handle exceptions in your application - more specifically how to handle them in your classes and still keep proper abstraction.So you already know how to handle your errors properly. Even if you're already using exceptions, there are some nuances to the use of exceptions that are important to know and understand in order to write code that is easier to reuse and more decoupled. Let's talk about exceptions and how they relate to your classes and...
I'm currently doing research and prototyping for autoloading alternatives in
Zend Framework 2.0. One approach
I'm looking at involves creating explicit class/file maps; these tend to be
much faster than using the include_path, but do require some
My algorithm for generating the maps was absurdly simple:
Scan the filesystem for PHP files
If the file does not contain an interface, class, or abstract class,
If it does, get its declared namespace and classname...
Over the years, I have gotten quite a few "complaints" from PHPUnit users that they do not like typing $this- as often as they have...
On the PEAR blog there's a new post updating you on some of the happenings with the PHP packaging tool recently.We've been fairly quiet, launching pear2 and pyrus into the line up, welcoming new faces to the QA team, Jesus Espino, and getting ready to call an election for the new pear group.They also mention several package releases (including updates to Net_DNS and Services_Twitter) and a call for contributions from anyone out there by working on deprecated code, unit tests or even just bug reports.
During the development of an application, not all time is spent
on writing code. A lot of time is spent on reading debug output,
crawling through log files and firing up the debugger to figure
out what the application does. While the debugger helps us to
inspect details of a running application on a testing
environment, logfiles are often the only indication of the origin
of an error on a production system. In this blogpost I want to
describe how to log SQL statements on an existing application...
Latest PEAR Releases:
I spent the weekend in Bristol so I could attend cicon2010 - a volunteer-organised first-edition conference around the CodeIgniter PHP Framework. It started on Saturday morning with registration at 8:30am and the first talk at 9am. When I arrived (at about ten to nine) there were no organisers there. I took this photo around 9:45 (the camera is on GMT) as they attempted to set up the projector.
I saw two talks, both of which were actually really good, which is pretty impressive when you're going on...
I recently surveyed the Burlington, VT PHP Users Group to get an idea of what motivates people to be involved with the group. I got the idea from a blog post on the top 7 reasons why people join a user group community. This was certainly not a scientific survey and there were only 16 responses, but it still offers some insight that can be useful in planning user group activities. Here are the top reasons, in order of most important to least important:
Network and make new connections
Learn from your...
I've been working on some changes to mtrack (a software development tracker
implemented in PHP) this weekend, with a focus on
improving the user experience for the mtrack administrator. To be brutally
honest, it was at best a meagre experience for the administrator, but now
things are better. They're still not perfect, but it should be a low
enough bar to encourage more folks to play with mtrack. I've also spent a
little bit of effort to add some caching to improve performance for certain...
After a recent release of Phergie, I came across a few issues stemming partly from odd behavior in the PHP FilterIterator class.
First,A FilterIterator subclasses causes segfault" href="http://bugs.php.net/bug.php?id=52559"bug #52559.A At the time, I was trying to troubleshoot why the first element seemed to be skipped during iteration by a subclass of FilterIterator. Not knowing that FilterIterator contained no count() method at the time, I tried calling it to get the number of elements in the original...
I've just released the PHP PEAR library File_MARC 0.6.0. This release brings two JSON serialization output methods for MARC to the table:
toJSONHash() returns JSON that adheres to Bill Dueber's proposal for the array-oriented MARC-HASH JSON format at New interest in MARC-HASH JSON
toJSON() returns JSON that adheres to Ross Singer's proposal for an object-oriented JSON format (I could only find a sample at this paste - not sure if there's a broader description anywhere, but really -- who needs it?)
What's the pear project been up to recently? We've been fairly quiet, launching pear2 and pyrus into the line up, welcoming new faces to the QA team, JesAşs Espino, and getting ready to call an election for the new pear group.
In addition to that, we've seen releases of Net_DNS, Net_IPv4, Services_Twitter, and File_MARC (read more) to name a few.
We've seen a fair few of the more active members of the community go into hibernation as life gets busier, so if you've ever wanted to help out with PEAR; now...
There are plenty of bad things in the world. But I guess there is nothing that has such a drastic and dangerous impact on my life that software patents. If patents are good thing in other industries can be discussed, but in the software industry its a clear cut thing: they hurt innovation, they hurt small businesses and they scare the shit out of me. And if you are a software developer, they should scare the shit out of you too! Now Oracle decided as the first big company that is not just a patent troll...
In this recent post from Jeremy Cook he take a look at an interesting use of closures in PHP - using them recursively to strip slashes off a string.One thing all of my projects have in them is code to remove the quotes added so I can handle appropriate escaping myself. This [example from the PHP manual] works perfectly but it does end up creating a function in the global namespace which is only called once. A perfect job for a closure.He includes an example of how to do it with a normal, globally-defined...
On the EchoDitto Labs blog there's a new post about getting Eclipse PDT with Zend Server Debugger on MAMP for Drupal (by Jeremy John).Anything involving Eclipse is always epic. First, you have to get your head around what distribution of it to use, as confusing as one's first introduction to Linux distributions (there are different kinds of Linux?). Next, you have to grok the fact that the Zend Debugger must be installed on your server. In this case, MAMP. Then, you have to make Eclipse listen to the...
Alex Mills has a interesting post to his blog answering a question he and several of the other WordPress developers at Automatic get about their blogging engine - why it doesn't including a default caching layer.WordPress does actually have a built-in cache called the object cache. It was introduced way back in 2005 1 and it basically caches database query results. [...] However as soon as the page is done being generated, that object cache is discarded. Initially the object cache cached these little...
On the Zend Developer Zone today there's a new post from Vic Cherubini about a new PHP 5.3 only framework - Jolt.Since [I wrote a previous framework], PHP5.3 was released and added a whole slew of features. Wanting to take advantage of them, I rewrote (and renamed) the entire framework from Artisan System to Jolt. The interesting thing about Jolt is that it intentionally doesn't come with any type of ORM or ActiveRecord classes. Because I believe that Models should be fat, and controllers skinny, the...
On the PHP-GTK blog today there's a new post looking at getting the latest versions of PHP (5.3) and PHP-GTK up and running on a Ubuntu-based system.At the moment there are some minor problems when trying to get a working installation of PHP with GTK running on Ubuntu based systems. Here is a quick walk through of how you can get this all set up with the trunks from GTK and Cairo and the official package for php-cli in 10 easy steps. This installation was originally done on Linux Mint 9 but should work...
As a part of the Dev Derby he's participating in, Chance Garcia has put together a list of books that he sees as beneficial to developers out there to hone their craft.Our book selections are not limited to our respective Languages. I thought I would share my list with everyone. The first 2 (GoF design patterns and Patterns of enterprise application architecture) really just need to be in every developer's library. The rest are a collections of books I've read and liked as well as recommendations from...
Latest PHP Tweets