Issues

ZF-8629: Doctrine_Hydrator_ArrayDriver segfaults Php when loaded by Zend_Loader_Autoloader

Description

Apache and Php segfault with no error information in the logs and a white screen of death when I use Doctrine 1.2.1 in a Zend Framework controller.

I've traced the problem to line 126 of Zend/Loader/Autoloader.php which only seemed to occur when it autoloaded Doctrine_Hydrator_ArrayDriver during a call to save() in the controller.

I debugged with xdebug and have attached a simple test controller with no other code. The ZF page works fine when all Doctrine is commented out and a Doctrine test page with the same code but outside of ZF worked fine via Apache as did a CLI script.

Workaround is to not push Doctrine to Zend Loader in the bootstrap.

Here is the debug output just before a segfault, the stack and the variable values:

Remote Launch (stepping)
Library/Zend/Loader/Autoloader.php.Zend_Loader_Autoloader::autoload : lineno 126
Library/Zend/Loader/Autoloader.php.is_subclass_of : lineno 0
Library/Doctrine/Query.php.Doctrine_Query->processPendingFields : lineno 477
Library/Doctrine/Query.php.Doctrine_Query->buildSqlQuery : lineno 1213
Library/Doctrine/Query.php.Doctrine_Query->getSqlQuery : lineno 1122
Library/Doctrine/Query/Abstract.php.Doctrine_Query_Abstract->_getDqlCallbackComponents : lineno 1137
Library/Doctrine/Query/Abstract.php.Doctrine_Query_Abstract->_preQuery : lineno 1106
Library/Doctrine/Query/Abstract.php.Doctrine_Query_Abstract->execute : lineno 1001
Library/Doctrine/Template/Listener/Sluggable.php.Doctrine_Template_Listener_Sluggable->getUniqueSlug : lineno 207
Library/Doctrine/Template/Listener/Sluggable.php.Doctrine_Template_Listener_Sluggable->buildSlugFromFields : lineno 120 Library/Doctrine/Template/Listener/Sluggable.php.Doctrine_Template_Listener_Sluggable->preInsert : lineno 65
Library/Doctrine/Record/Listener/Chain.php.Doctrine_Record_Listener_Chain->preInsert : lineno 342
Library/Doctrine/Record.php.Doctrine_Record->invokeSaveHooks : lineno 355
Library/Doctrine/Connection/UnitOfWork.php.Doctrine_Connection_UnitOfWork->insert : lineno 551
Library/Doctrine/Connection/UnitOfWork.php.Doctrine_Connection_UnitOfWork->saveGraph : lineno 81
Library/Doctrine/Record.php.Doctrine_Record->save : lineno 1691 Application/controllers/TestingController.php.TestingController->indexAction : lineno 20
Library/Zend/Controller/Action.php.Zend_Controller_Action->dispatch : lineno 513
Library/Zend/Controller/Dispatcher/Standard.php.Zend_Controller_Dispatcher_Standard->dispatch : lineno 289
Library/Zend/Controller/Front.php.Zend_Controller_Front->dispatch : lineno 946
Library/Zend/Application/Bootstrap/Bootstrap.php.Zend_Application_Bootstrap_Bootstrap->run : lineno 77
Application/Bootstrap.php.Bootstrap->run : lineno 52
Library/Zend/Application.php.Zend_Application->run : lineno 346 Public/index.php.{main} : lineno 26

=-=-=-=-=-=

$class Doctrine_Hydrator_ArrayDriver
$object Zend_Loader_Autoloader
autoloaders Array [1]
0 Array [2]
0 Doctrine
1 autoload
_defaultAutoloader Array [2]
0 Zend_Loader 1 loadClass
_fallbackAutoloader false
_internalAutoloader Array [2]
0 Zend_Loader_Autoloader
1 _autoload
_namespaces Array [5]
Zend
true
ZendX_ true
Lisantra_ true
Persistence_ true
Doctrine_ true
namespaceAutoloaders Array [1]
Array [1]
0 Array [2]
0 Doctrine
1 autoload
_suppressNotFoundWarnings false
$self Zend_Loader_Autoloader
_autoloaders Array [1]
0 Array [2]
0 Doctrine
1 autoload
_defaultAutoloader Array [2]
0 Zend_Loader 1 loadClass
_fallbackAutoloader false
_internalAutoloader Array [2]
0 Zend_Loader_Autoloader
1 _autoload
_namespaces Array [5]
Zend
true
ZendX_ true
Lisantra_ true
Persistence_ true
Doctrine_ true
_namespaceAutoloaders Array [1]
Array [1]
0 Array [2]
0 Doctrine
1 autoload
_suppressNotFoundWarnings false
$method _autoload
$autoloader Array [0]

Comments

Hehe. Spent a few hours worried this was just me ;). But yes, in certain scenarios Doctrine craps out when autoloaded this way. I haven't dug any deeper into why but my own xdebug trace ends after trying to autoload the Hydrator.