Just a quick note to say I successfuly passed my Zend PHP 5 Certification this morning.
A propos
- About me: Geoffrey Bachelet
- Profile LinkedIn
To content | To menu | To search
Friday 21 March 2008
By Geoffrey on Friday 21 March 2008, 13:03 - Ego
Just a quick note to say I successfuly passed my Zend PHP 5 Certification this morning.
Monday 5 November 2007
By Geoffrey on Monday 5 November 2007, 14:37 - Coding
Today I ran into an issue while extending Zend_Controller_Router_Route. I wanted to add a little path pre/post processing in the match() and assemble() methods, so I just extended the Route class to add my tiny bits of code into the methods. Except it did not work at all. After a few debuging, it turned out that the Router uses Zend_Controller_Router_Route::getInstance() to retrieve a route object, which uses a new self(); statement to instantiate the route object. Problem is that self always refers to the current class definition we're in, if the method is called from a child class, without being overloaded, self will refer to the wrong class.
Example:
class Foo {
public static function getInstance() {
return new self;
}
}
class Bar extends Foo {}
var_dump(Bar::getClass());
echoes something like:
object(Foo)#1 (0) {
}
Which is fscking wrong IMHO. A quick workaround is to overload the getInstance method, which is what I call pretty annoying as it does not follow the DRY principle.
Thursday 30 August 2007
By Geoffrey on Thursday 30 August 2007, 11:57 - Geekeries
If you're wondering how much of a hassle it would be to migrate your app / codebase to php5, try the following command line (after having installed the php5-cli package of course):
find . -name "*.php" -exec /usr/bin/php5 -l {} \; | grep -v 'No syntax errors'
It'll show you all the files with syntax errors in it.