Fixes for PHP 5.3 compatibility.

I would suggest not making your package PHP 5.4 only just to use short array syntax. Here are fixes for PHP 5.3. We're using this in a production application on PHP 5.3.