[TYPO3-templavoila] Template Object could not be unserialized successfully

Xavier Perseguers typo3 at perseguers.ch
Tue May 19 08:26:13 CEST 2009

Hi François,

>> Template Object could not be unserialized successfully
>> Are you sure you saved mapping information into Template Object with 
>> UID "1"?
> I had this error a few times, while changing the encoding of a site. The 
> serialized data was read badly and thus unserializing failed. In such 
> cases I had to remap the HTML template, while taking care that the HTML 
> file itself had a compatible encoding.
> I don't know if this applied somehow to your situation too.

No, as it can be unserialized successfully when having the default 
language (L=0).

I investigated the problem and I located the stuff but I still don't 
understand why it does not work.

In EXT:templavoila/class.tx_templavoila_htmlmarkup.php, in method 
getTemplateRecord(), at the beginning the template record is retrieved 
and it works fine but at the end there is

} elseif ($langUid) { // If the language uid is set, then try to find a 
regular record with sys_language_uid

The problem is that it gets into $printRow an empty array and then

if (is_array($printRow)) {
     $rec = $printRow;
} elseif (....

Bing! My default record is overwritten by an empty array, meaning I then 
get my error "Template Object could not be unserialized successfully" in 

If I change the test to

if (is_array($printRow) && count($printRow) > 0) {
     $rec = $printRow;
} elseif (....

Then it works as expected. I just wonder why I don't have this problem 
on other installations.

Xavier Perseguers


More information about the TYPO3-project-templavoila mailing list