I recently came across what I would consider a bug, for Doctrine2. Basically, I had created an entity in Symfony2 that I needed to have a boolean that told me if this entry could be shown publicly or not. Without thinking I went ahead and put it down as $show.
Since I had set the column name in the annotations, it was automatically taken as the actual field name in the database, when I used doctrine to update the schema. It worked fine, and upon checking the database it all looked correct. I moved on to the code in charge of adding and editing the records for the table.
I quickly finished up the core code and tested it, only to find a message about SQLSTATE[42000], with a query that looked absolutely fine to me. I went over it a few times, and couldn’t see an issue with it, so I decided to see what this sql state meant. The first few results in Google suggested I was using a keyword in the wrong spot, so I went back and looked at the error message. Sure enough I noticed that show was being used in the insert query.
Once I looked up MySQL to double-check that show was a keyword, I went back and changed the column name to viewable, and updated the schema once more. Sure enough it worked fine this time, and that was the end of the issue.
It left me thinking though. ‘Why wouldn’t it give me an error when updating the schema?’. I decided I’d leave a bug report on the doctrine tracking site explaining the issue. Hopefully they will change it to either always break, or never break by escaping it in queries.