$invocation->modules needs unserialize for empty() to work
Description of Erratum
You mention that you caught missing unserialize() in a different place. $invocation->modules is "a:0{}"; so empty() doesn't produce the right result unless you wrap it in unserialize here as well.
Recommended Correction
if (unserialize(empty($invocation->modules))) {
$modules_text = t('None');
}