fixed a PHP notice when trying to access a key on a non-object/array variable

This commit is contained in:
Fabien Potencier
2012-04-12 14:36:25 +02:00
parent 58fbe0da41
commit 4e28408ce1
3 changed files with 18 additions and 2 deletions
+14
View File
@@ -10,6 +10,20 @@
*/
class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
{
/**
* @expectedException Twig_Error_Runtime
* @expectedExceptionMessage Impossible to access a key ("a") on a "string" variable
*/
public function testAttributeOnAString()
{
$template = new Twig_TemplateTest(
new Twig_Environment(null, array('strict_variables' => true)),
false
);
$template->getAttribute('string', 'a', array(), Twig_TemplateInterface::ARRAY_CALL, false);
}
/**
* @dataProvider getGetAttributeTests
*/