Google Groups

Re: doctrine 2.0 segmentation fault when parsing dql


victor.olaru Oct 6, 2011 12:31 AM
Posted in group: doctrine-user
I found the bug that most probably caused the crash, I'm not sure but
I think it is a php bug.
The problem lies in Doctrine\ORM\Query\ResultSetMapping function
AddFieldResult, line 202.
The dubious ?: syntax seemed to be the problem. I instead replaced it
more explicitly like this:

$this->declaringClasses[$columnName] = empty($declaringClass) ? $this-
>aliasMap[$alias]: $declaringClass;

If you read in the not so extensive documentation about the ternary
operator it php you will find out that
Since PHP 5.3, it is possible to leave out the middle part of the
ternary operator. Expression expr1 ?: expr3 returns expr1 if expr1
evaluates to TRUE, and expr3 otherwise.
Please note that the ternary operator is a statement, and that it
doesn't evaluate to a variable, but to the result of a statement. This
is important to know if you want to return a variable by reference.
The statement return $var == 42 ? $a : $b; in a return-by-reference
function will therefore not work and a warning is issued in later PHP
versions.

So there is a problem with the return-by-reference for the ?: syntax.
That's way I explicitly wrote what should be returned.

Now it works, good luck to you all!
Victor

On Aug 31, 5:08 pm, "victor.olaru" <victor.ol...@gmail.com> wrote:
> Hy,
> I have integrated doctrine 2.0 with zend framework and something goes
> wrong with that:
> When I try to send the simplest dql the apache process crashes with
> signal 11.
> Is there any quick tips about this, or do I have to provide more
> details to get an answer?
>
> Thanks,
> Victor