ZF-11463: Undefined class constant | SaveHandler
Description
Error shows after Zend_Exception is thrown. Undefined class constant 'PRIMARY_TYPE_NUM' in /library/Zend/Session/SaveHandler/DbTable.php on line 522
Error shows after Zend_Exception is thrown. Undefined class constant 'PRIMARY_TYPE_NUM' in /library/Zend/Session/SaveHandler/DbTable.php on line 522
Comments
Posted by Adam Lundrigan (adamlundrigan) on 2011-06-13T14:36:07.000+0000
Could you provide some sample code showing how you're using Zend_Session_SaveHandler_DbTable, how you handle the exception, and some information on the exception that was thrown? (esp: the class name and stack trace)
Posted by Tibo Beijen (tbeijen) on 2011-06-27T09:31:28.000+0000
We're running into the same issue. It's just a fatal error, there's no exception. We're using Zend Framework 1.9.7
Error occurs on a PHP 5.3.3 server. Same code runs fine on a PHP 5.3.6 server
Error log:
Server having fatal error:
Server running fine:
Posted by Adam Lundrigan (adamlundrigan) on 2011-06-28T16:59:18.000+0000
@Tibo: Can you try it on PHP 5.3.3 with the latest ZF release? (or better yet, against SVN trunk)
I can't reproduce the issue against trunk on my dev machine:
Posted by Nikolai Zujev (jaymecd) on 2011-07-08T12:14:23.000+0000
Hi,
I've discovered this issue few mins ago and found solution. checked with PHP 5.3.3 and ZF 1.11.7 & 1.11.8
How to reproduce: - use DbTable handler - trigger fatal error - see error message describer above
After debugging noticed that object is already destroyed and it does not have any static properties.
Workaround is taken from php.net manual.
Pay attention to this note: {panel:title=http://php.net/manual/en/…} As of PHP 5.0.5 the write and close handlers are called after object destruction and therefore cannot use objects or throw exceptions. The object destructors can however use sessions. {panel}
By setting shutdown callback as: register_shutdown_function('session_write_close'); in the entry point (index.php) you avoid this issue.
Have a nice day, Nick
Posted by Nikolai Zujev (jaymecd) on 2011-07-08T20:38:40.000+0000
UPD. forgot to mention - front controller should be set to throw exceptions, aka in development mode.
Posted by elzo valugi (valugi) on 2012-02-27T09:53:25.000+0000
I get the same errror. This is quite strange as the user has SELECT rights.
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'green'@'localhost' for table 'application__users'' in /var/opt/ZendFramework/trunk/library/Zend/Db/Statement/Pdo.php:228
Stack trace: #0 /var/opt/ZendFramework/trunk/library/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array) #1 /var/opt/ZendFramework/trunk/library/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array) #2 /var/opt/ZendFramework/trunk/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array) #3 /var/opt/ZendFramework/trunk/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('DESCRIBE
mydb...', Array) #4 /var/opt/ZendFramework/trunk/library/Zend/Db/Adapter/Pdo/Mysql.php(169): Zend_Db_Adapter_Pdo_Abstract->query('DESCRIBEmydb...') #5 /var/opt/ZendFramework/trunk/library/Zend/Db/Table/Abstract.php(835): Zend_Db_Adapter_Pdo_Mysql->describeTable('application__us...', 'mydb') #6 /var/opt/ZendFra in /var/opt/ZendFramework/trunk/library/Zend/Controller/Plugin/Broker.php on line 312 Fatal error: Undefined class constant 'PRIMARY_TYPE_NUM' in /var/opt/ZendFramework/trunk/library/Zend/Session/SaveHandler/DbTable.php on line 522Posted by Juraj Seffer (jurajseffer) on 2012-08-20T13:51:40.000+0000
This exception seems to pop up only when another (fatal) error occurs before that.