Stephen's dev blog

symfony Unable to parse default value as date/time value: ‘0000-00-00 00:00:00′

Posted by: Stephen Gray on: 26 September, 2008

I’ve just made a change to a symfony project’s schema.yml file and tried to rebuild the model and came across this error message:

Unable to parse default value as date/time value: ‘0000-00-00 00:00:00′

Which was stopping the build. After looking at various places, it seems this is a problem with Creole, (propel’s DBAL).

Before PHP v5.2.4, you could do a strtotime on a value of 000-00-00 00:00:00 and you would get a weird date, something in 1999. Not sure why :S Since the 5.2.4 update however this bug has been fixed and you will now get boolean false returned.

The symfony plugin sfGuard, which is widely used, uses 0000-00-00 00:00:00 as a default value in it’s schema for some fields and this will now cause problems. To fix this, edit sfGuard’s schema and change those default values to something like 1970-01-01 and that should do the trick.

Unfortunately Creole isn’t actively maintained anymore so it’s not likely to be updated soon to fix this.

Leave a Reply