Empty order emails (no subject, no body)
One of my customers had a problem this week:
Emails looked like this:
It was literally empty. The server filled a few head fields, but there was nothing left of the content we want to send (new order email).
It took a while, but finally I think I found the problem (unfortunatelly not sure about the cause).
Magento saves stuff while going down this trace:
\Mage_Core_Model_Abstract::save
\Mage_Core_Model_Resource_Db_Abstract::save
\Mage_Core_Model_Resource_Db_Abstract::_prepareDataForSave
\Mage_Core_Model_Resource_Abstract::_prepareDataForTable
\Varien_Db_Adapter_Pdo_Mysql::describeTable
This method should return an array like this:
...
[created_at] => Array
(
[SCHEMA_NAME] =>
[TABLE_NAME] => core_email_queue
[COLUMN_NAME] => created_at
[COLUMN_POSITION] => 8
[DATA_TYPE] => timestamp
[DEFAULT] =>
[NULLABLE] => 1
[LENGTH] =>
[SCALE] =>
[PRECISION] =>
[UNSIGNED] =>
[PRIMARY] =>
[PRIMARY_POSITION] =>
[IDENTITY] =>
)
[processed_at] => Array
(
[SCHEMA_NAME] =>
[TABLE_NAME] => core_email_queue
[COLUMN_NAME] => processed_at
[COLUMN_POSITION] => 9
[DATA_TYPE] => timestamp
[DEFAULT] =>
[NULLABLE] => 1
[LENGTH] =>
[SCALE] =>
[PRECISION] =>
[UNSIGNED] =>
[PRIMARY] =>
[PRIMARY_POSITION] =>
[IDENTITY] =>
)
...
But it returned
[data] => a:9:{s:10:"message_id";a:14:{s:11:"SCHEMA_NAME";N;s:10:"TABLE_NAME";s:16:"core_email_queue";s:11:"COLUMN_NAME";s:10:"message_id";s:15:"COLUMN_POSITION";i:1;s:9:"DATA_TYPE";s:3:"int";s:7:"DEFAULT";N;s:8:"NULLABLE";b:0;s:6:"LENGTH";N;s:5:"SCALE";N;s:9:"PRECISION";N;s:8:"UNSIGNED";b:1;s:7:"PRIMARY";b:1;s:16:"PRIMARY_POSITION";i:1;s:8:"IDENTITY";b:1;}s:9:"entity_id";a:14...
As you might guess, this is a serialized array.
When we have a look into \Varien_Db_Adapter_Pdo_Mysql::loadDdlCache
we see, that the schema is cached, but I think there is no way, the serialized data are returned:
// lib/Varien/Db/Adapter/Pdo/Mysql.php:1548
$data = $this->_cacheAdapter->load($cacheId);
if ($data !== false) {
$data = unserialize($data);
To be continued...