mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 11:27:00 +00:00
Merge branch '1.x' into 2.x
* 1.x: bumped version to 1.33.3-DEV prepared the 1.33.2 release fixed edge case in the method cache for Twig attributes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
* 2.3.2 (2017-XX-XX)
|
||||
|
||||
* n/a
|
||||
* fixed edge case in the method cache for Twig attributes
|
||||
|
||||
* 2.3.1 (2017-04-18)
|
||||
|
||||
@@ -47,10 +47,14 @@
|
||||
* improved the performance of the filesystem loader
|
||||
* removed features that were deprecated in 1.x
|
||||
|
||||
* 1.33.2 (2017-XX-XX)
|
||||
* 1.33.3 (2017-XX-XX)
|
||||
|
||||
* n/a
|
||||
|
||||
* 1.33.2 (2017-04-20)
|
||||
|
||||
* fixed edge case in the method cache for Twig attributes
|
||||
|
||||
* 1.33.1 (2017-04-18)
|
||||
|
||||
* fixed the empty() test
|
||||
|
||||
@@ -1547,12 +1547,15 @@ function twig_get_attribute(Twig_Environment $env, Twig_Source $source, $object,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($classCache[$name])) {
|
||||
$classCache[$name] = $method;
|
||||
}
|
||||
// skip get() and is() methods (in which case, $name is empty)
|
||||
if ($name) {
|
||||
if (!isset($classCache[$name])) {
|
||||
$classCache[$name] = $method;
|
||||
}
|
||||
|
||||
if (!isset($classCache[$lcName])) {
|
||||
$classCache[$lcName] = $method;
|
||||
if (!isset($classCache[$lcName])) {
|
||||
$classCache[$lcName] = $method;
|
||||
}
|
||||
}
|
||||
}
|
||||
$cache[$class] = $classCache;
|
||||
|
||||
@@ -366,6 +366,20 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Runtime
|
||||
*/
|
||||
public function testGetIsMethods()
|
||||
{
|
||||
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true));
|
||||
$getIsObject = new Twig_TemplateGetIsMethods();
|
||||
$template = new Twig_TemplateTest($twig, array('strict_variables' => true));
|
||||
// first time should not create a cache for "get"
|
||||
$this->assertNull(twig_get_attribute($twig, $template->getSourceContext(), $getIsObject, 'get'));
|
||||
// 0 should be in the method cache now, so this should fail
|
||||
$this->assertNull(twig_get_attribute($twig, $template->getSourceContext(), $getIsObject, 0));
|
||||
}
|
||||
}
|
||||
|
||||
class Twig_TemplateTest extends Twig_Template
|
||||
@@ -633,6 +647,17 @@ class Twig_TemplateMethodObject
|
||||
}
|
||||
}
|
||||
|
||||
class Twig_TemplateGetIsMethods
|
||||
{
|
||||
public function get()
|
||||
{
|
||||
}
|
||||
|
||||
public function is()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class Twig_TemplateMethodAndPropObject
|
||||
{
|
||||
private $a = 'a_prop';
|
||||
|
||||
Reference in New Issue
Block a user