mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-11 18:06:46 +00:00
cast $name to a string as $name can in fact be an object implementing __toString function as true in my case.
This commit is contained in:
@@ -98,6 +98,8 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
*/
|
||||
public function displayParentBlock($name, array $context, array $blocks = array())
|
||||
{
|
||||
$name = (string) $name;
|
||||
|
||||
if (isset($this->traits[$name])) {
|
||||
$this->traits[$name][0]->displayBlock($name, $context, $blocks);
|
||||
} elseif (false !== $parent = $this->getParent($context)) {
|
||||
@@ -119,6 +121,8 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
*/
|
||||
public function displayBlock($name, array $context, array $blocks = array())
|
||||
{
|
||||
$name = (string) $name;
|
||||
|
||||
if (isset($blocks[$name])) {
|
||||
$b = $blocks;
|
||||
unset($b[$name]);
|
||||
@@ -189,7 +193,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
*/
|
||||
public function hasBlock($name)
|
||||
{
|
||||
return isset($this->blocks[$name]);
|
||||
return isset($this->blocks[(string) $name]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user