FriendsOfSymfony1 / doctrine1

[DEPRECATED -- Use Doctrine2 instead] Doctrine 1 Object Relational Mapper.
http://www.doctrine-project.org
GNU Lesser General Public License v2.1
40 stars 75 forks source link

Cannot declare self-referencing constant 'Doctrine_Query::STATE_CLEAN' #42

Closed Tybaze closed 5 years ago

Tybaze commented 6 years ago

You will trigger a : Fatal error: Uncaught Error: Cannot declare self-referencing constant 'Doctrine_Query::STATE_CLEAN'

If you try to call in this order : $q = new Doctrine_RawSql($conn); $q = new Doctrine_Query($conn);

This is due to the fact that Doctrine_RawSql extends Doctrine_Query_Abstract, so PhP had to declare both of them.

But Doctrine_Query_Abstract also require Doctrine_Query to get the "default" $_state , which is Doctrine_Query::STATE_CLEAN.

And then when you instantiate a new Doctrine_Query() which also extend Doctrine_Query_Abstract(), Php try to declare again Doctrine_Query, which constant has already been declared during the previous declaration of Doctrine_RawSql > "extends" > Doctrine_Query_Abstract > "needs" > Doctrine_Query

Solution : call the Abstract class directly

Tested and reproduced on php7.0 and Php7.1 Php5.6 and bellow are not impacted (not tested on php 5.7) Bug fix tested on php7.0 7.1 5.6 and 5.5

thePanz commented 5 years ago

Closed, as fixed in #71