Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291469

Exception message when trying to print an object without __toString() in a Twig template is not helpful

$
0
0

@Berdir mentioned this issue to me today on IRC.

Relevant code from twig.engine:

<?php
 
if (is_object($arg)) {
    if (
method_exists($arg, '__toString')) {
      return (string)
$arg;
    }
    throw new
Exception(t('Object of type "@class" cannot be printed.', array('@class'=> get_class($arg))));
  }
?>

If possible we should mention the variable name as well as the template where this is being called from - that would be a big improvement.


Viewing all articles
Browse latest Browse all 291469

Trending Articles