Pragmatism in the real world

Zend Framework 0.1.2

The Zend Framework 0.1.2 is now out, so it’s time to get out WinMerge and see what’s changed :)

There’s lots of changes, one of which I reported! Zend::loadClass() and Zend::loadInterface() now work with __autoload !

Other highlights are a lot of changes to the filter stuff and a few other changes to the other main modules.

I have only looked at the View and the Controller modules so far so will only comment on them.

Zend/View

This one is easy as there’s only one interesting change

There’s a new function in Zend_View_Abstract called __isset(). Interestingly it’s commented like this:

Allows testing with empty() and isset() to work inside templates — only available on PHP 5.1

For a framework with a stated goal of being PHP 5.0.4+, I find this interesting. Personally I think that PHP 5.1 should be the minimum version required anyway, so am not too bothered.

There’s a bug fix in Zend_View_Abstract::_setPath() so that it looks for the plural of the type for the directory. i.e. /helpers/ rather than /helper/.

Zend/Controller

The Controller directory has a lot of changed files. Fortunately the number of real changes isn’t that large!

The first major change is that Zend_Controller_Dispatcher_Action has been renamed Zend_Controller_Dispatcher_Token. This is a good change as “Action” is a very overused term at the best of times and Token is a far better description of what this class is used for.

Obviously as a result of the rename, a fair few files within the Controller directory were comment updates :)

Zend_Controller_Action has lost it’s persistance functionality. This is quite useful for me as my subclass which hooks the Controller to the View relies on persistance not being used! A consequence of this is that Zend_Controller_Action::run() now returns a Zend_Controller_Dispatcher_Token directly rather than an array. This change also affects the Zend_Controller_Dispatcher, making it simpler.

One thing that is odd in Zend_Controller_Action is that the variable name for the Zend_Controller_Dispatcher_Token is still $action and $_nextAction. I think it would be helpful if it was renamed $token and $_nextToken sooner rather than later. A similar renaming would be helpful in the Zend_Controller_Dispatcher and Zend_Controller_Front classes too.

Zend_Controller_Router now implements Zend_Controller_Router_Interface which is handy. The Zend_Controller_Router_Interface interface existed in 0.1.1 but it’s definition of route() was broken which has now been fixed too.

So that’s what I noticed when looking through the changes in the Zend_Controller between 0.1.1 and 0.1.2. It’s a good job that I’ve only played with two modules really :)