Archive for Oktober, 2010

Doctrine 1.2.3 Segmentation fault

Samstag, Oktober 9th, 2010

Today we learned, that – with the stars properly aligned – doing the right mistakes in using Doctrine can actually make PHP cause a Segmentation fault.

So far I have not been able to reproduce the problem in an Apache environment; but running PHPUnit from the CLI, the issue could be reproduced consistently.

The root of the evil is using Doctrine’s Behaviour/Templates in an ill-advised way. In this particular situation, a model had a behaviour defined and, at the same time, a custom column definition for columns also specified by the behaviour.

Doctrine does a lot of internal magic — possibility for behaviour parameter validation is unfortunate, though. When creating your own behaviours for example, throwing exceptions to notify the programmer using the behaviour that some of the passed parameters are invalid, Doctrine catches and „swallows“ these so they never can be seen and considered… So far, looking at e.g. unit tests for the build-in behaviours I have not figured out how to do this „right“.

Anyhow, a Segmentation fault should hardly be the result of any configuration mistake. I will try to create a test case in a fresh environment (other that the fair size project this happened in), and take a closer look on how to reliably reproduce the issue and use a debugger to confirm the reason really can be found inside Doctrine’s code or if some other 3rd party software (XDebug, …) has any influence.