News from the back

A few days ago several proposals which I’ve written in past have been accepted.
I’m sorry to say that, but as 1.9 is already waiting at the door non of this proposals will be within ZF 1.9.

Let’s take a look at the components which are accepted and what 1.10 could have as new feature from my side:

*) Zend_Filter_Compress:
A compression filter… this one can already be found within the incubator in a preview version. It supports ZIP, GZ, BZ2 and LZF. It will be within 1.10. I’m not sure if I will add also other compression formats.

*) Zend_Filter_Boolean:
A filter converting all things to boolean BUT additionaly supports “true”, “false” strings and “yes”, “no” strings from any language.

*) Zend_Validate_PostCode:
A validator which checks if a input is a postal code regardless of its country

*) Zend_Validate_Phone:
A validator which checks if a input is a phone number in a defined format. This one is a little bit tricky and should have a cousine Zend_Filter_Phone. In the time I wanted to add it another guy added his own idea of a phone filter. As I saw it does not conform the ITU standard nor does it work with non-US numbers. I will add my version and look if those two can be combined. As I am originally a certified professional telecommunication engineer I should be the best for creating such a component :-) So this one will still take some time.

*) Zend_Validate_Callback:
A validator which can use your own custom functions as validator.

*) Zend_View_Helper_Currency:
A view helper to simplify the handling of currencies.

*) Zend_View_Helper_Date:
A view helper to simplify the handling of dates.

Additionally Zend has accepted the proposal from Mikael and me regarding a completly reworked documentation. It is already cored (even if the work itself is not done for now :-) ) and will add things like
- Translated Quickstart Guide
- Comments for the manual
- A great tool for translators which simplifies finding errors and problems (this one will propably added to Zend’s CI server)
- and much much more

Now you may say this is enough work for one person… you may be right… but I still have some ideas for which I have not written proposals until now.

For 1.9 I have added plural support for Zend_Translate in May. But until now it has not been accepted, so I expect that this feature will be delayed to 1.10.

As always I will keep you informed about my work. Have a nice ZF-ing.

Thomas Weidner
I18N Team Leader, Zend Framework

Zend Framework Advisory Board Member
Zend Certified Engineer for Zend Framework

Back to top

New ideas for the next ZF releases

I added some new proposals for which I had the ideas as I worked at the CLDR integration.
Some other new features and ideas will be added as feature enhancement and don’t need a proposal as they cover existing components.

* Zend_Validate_PostCode

A proposal for a new validator I added today. It is able to validate postal codes for all countries. Of course you could say that someone can also use the regex validator to provide this feature. But this would be hard as most people don’t know the correct regex strings and when you need to validate multiple countries (a webshop for several countries for example) such a validator would be much easier to use.

* Zend_Validate_Phone

A proposal for a new validator which will be able to validate if the given input is a phone number or not. Note that phone numbers are differently for each country, and in their notation. A number in an international format (+43 1 234567) does not match with a national number (01 234567). This validator will be able to check all of these different formats

* Zend_View_Helper_Date

A proposal for a new view helper which will simplify the rendering and usage of Zend_Date objects within a view.

* Translateable exceptions

The idea behind this proposal is that sometimes you need to translate exceptions. For example when you want to have your log in a language which your customer understands (many customers don’t understand english). But this proposal can also be used to change the message which an exception throws. This can be used to change the exception for example from “No database connection to MYDB” to “Db Problems… please ask your DBAdmin” which would also be a better way than retrowing the exception.

* Zend_Filter_Boolean

This filter will make it possible to change user input into a boolean value. Now you may say that you could simply cast to a boolean, but this filter does more than that. It will/can detect “yes”, “no” written in any language and change it to boolean. Maybe even the textual strings “true” and “false”.

* Zend_Filter_StringLength

This proposal describes a filter which will be able to do all work which changes the length of a string. This is not only stripping but also padding within the same filter. having both into the same filter has some advantage as you can define a minimum and a maximum string length.

* Zend_Validate_Callback

This will be a very neat validator. It is simply a callback which allows to use any self defined function or method to be usedas validator. It works nearly the same way as Zend_Filter_Callback.

* Zend_View_Helper_Currency

This proposal describes a view helper which will simplify the usage of currencies within a view. It makes use of Zend_Currency.

* Zend_Filter_Compress

This is the only proposal of all above mentioned which is already accepted. It will add compression and decompression support to ZF. Originally only intended for files it will at last also support string compression.

There are also some issues which are not big enough to be written as proposal but which implement features which will be very nice for most users.

* Zend_Currency improvements

I plan some improvements for Zend_Currency. These are a interface for exchange services. Note that Zend_Currency itself is not able to change between currencies… for example when you want ot know how much USD a EUR value is. Another improvement will be that Zend_Currency will then be able to calculate currencies. These two features are related to each other.

* Zend_Locale improvements

CLDR 1.7 added locale upgrading. Zend_Locale will implement this feature. This allows to get “en” from your user and then have “en_US” at the end without interaction. This works for all languages but is, of course, limited to the territories with the most speakers of this language. Zend_Locale itself already supports 3-letter locales which have not been supported in past. Additionally Zend_Locale accepts now also locales with additional informations. For example a locale like “en-Latn-Transnat-US” would be accepted and internally changed to “en_US”.

I have much more ideas than time to work on them :-)
Many of them can also be found within our wiki.

If you want me to work on some of these ideas faster then on others feel free to give your comments on the proposals and to vote for issues.

Thomas Weidner
I18N Team Leader, Zend Framework

Zend Framework Advisory Board Member
Zend Certified Engineer for Zend Framework

Back to top

It’s Update Time…

No task update since 3 weeks ? That can not be true. :-)

And you’re right… Of course there are several news, but they were too small to write a own entry. Therefor I will give you now a update of what has been done since 14.January.

File uploads:

  • Several people noted that they get an exception when they use the file element. And they noted that they is no filled $_FILES array in this case.

    The reason is simple: When the uploader exceeds the size definition from the php.ini file then the file is not accepted by PHP. As there is no file, PHP deleted it, the file element returns an error.

    The solution for this problem is of course also simple: Let’s use the web-browser to do this check for us. When you set the maximum filesize setMaxFileSize() then the browser checks if the file which should be uploaded exceeds this size.


    Within the next release this size check is automatically set by using the maximum values from the PHP.ini file.

  • 2 new methods have been added:
    getFileSize() returns the real size from the uploaded file. It does not rely on the informations of the $_FILES array.

    getMimeType() returns the real mimetype of the uploaded file. It uses the fileinfo extension or the mime extension for detection.

  • All methods have now support for multifiles: Several methods lacked the support like getErrors, setFilters and some others.

    If you expect problems with multifiles you should use ZF1.8 and higher or trunk.

  • getFileName() supports now also path reduction by it’s second parameter.

    This feature was added for all lacy ones which don’t want to use the getValue() method. ;-)

  • Several people noted in the past that the file element does not work due to false usage of setDecorator at the elements.

    As note: setDecorator() deletes all default decorators. But the file decorator is responsible for the hidden elements needed for file uploads to work properly and also for the correct naming schema.

    As solution to this problem I added a marker interface for the file element. This means as soon as you missuse setDecorator() and forget to add the file decorator before rendering it, an exception will be thrown.

  • In past, when the upload was processed, the file was first moved to the set destination (or the temporary directory), and after that the file was renamed according to the used rename() filter.

    As you can see, in this case, the file is moved twice. Once into the temp directory and then to it’s renamed location. The bigger the file, the more ressource intensive is this task.

    As solution I added a new behaviour: When a rename filter is added, then the destination from this filter is instantly used as moved location instead of moving the file twice.

  • Rob mentioned in his blog that the file element does not really work with the count validator. Specially when using multifiles.

    This really hard to solve bug was finally fixed… now the count validator works on normal file elements, multifiles and also multiple file elements as expected.

Localization informations:

  • I added new informations which can be requested using Zend_Locale’s getTranslationList() methods.
    You can now request 3 digit country codes and also 3 character country codes. These codes are often used within enterprise systems (f.e. banks).

Date detection:

  • I increased the date detection routines. They can now automatically handle 2 digit year notations like 120209 even when you give no format, or a false format. This has an positive effect on the date validator and also to the isDate method.

All above mentioned features are only available in trunk and will be released with ZF 1.8.

Additionally I have already some new features on hold. But they are still under review by the dev-team. So I will inform you as soon as they are cored. And I also added some new proposals, 5 in sum, which are eighter under review or under recommendation.

So I wish you a happy frameworking :-)

Thomas Weidner
I18N Team Leader, Zend Framework

Zend Framework Advisory Board Member
Zend Certified Engineer for Zend Framework

Back to top