php 5.3/4 compat

I was adding the project to Symfony and had to make a few changes.  This should be closer to the PHP API spec while being backwards compatible.