+++ /dev/null
---TEST--
-C extension causes php5-fpm to crash
---TEMPLATE--
-{{ data.test1 }}
---DATA--
-class test
-{
- public function __isset($key) {
- throw new Exception("Hey! Don't try to isset me!");
- }
-}
-
-return array('data' => new test())
---EXCEPTION--
-Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("Hey! Don't try to isset me!") in "index.twig" at line 2.
$template = $env->loadTemplate($name);
$context = array(
- 'string' => 'foo',
- 'array' => array('foo' => 'foo'),
- 'array_access' => new Twig_TemplateArrayAccessObject(),
+ 'string' => 'foo',
+ 'array' => array('foo' => 'foo'),
+ 'array_access' => new Twig_TemplateArrayAccessObject(),
+ 'magic_exception' => new Twig_TemplateMagicPropertyObjectWithException(),
);
try {
array('{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1', false),
array('{{ array_access.a }}', 'Method "a" for object "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1', false),
array('{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ _self.foo(array_access) }}', 'Method "missing_method" for object "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1', false),
+ array('{{ magic_exception.test }}', 'An exception has been thrown during the rendering of a template ("Hey! Don\'t try to isset me!") in "%s" at line 1.', false),
);
if (function_exists('twig_template_get_attributes')) {
}
}
+class Twig_TemplateMagicPropertyObjectWithException
+{
+ public function __isset($key)
+ {
+ throw new Exception("Hey! Don't try to isset me!");
+ }
+}
+
class Twig_TemplatePropertyObject
{
public $defined = 'defined';