mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 12:26:30 +00:00
cast $name to string ($name can be an object implementing __toString function)
This commit is contained in:
@@ -70,6 +70,8 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
|
|||||||
*/
|
*/
|
||||||
public function exists($name)
|
public function exists($name)
|
||||||
{
|
{
|
||||||
|
$name = (string) $name;
|
||||||
|
|
||||||
if (isset($this->hasSourceCache[$name])) {
|
if (isset($this->hasSourceCache[$name])) {
|
||||||
return $this->hasSourceCache[$name];
|
return $this->hasSourceCache[$name];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
|
|||||||
*/
|
*/
|
||||||
public function exists($name)
|
public function exists($name)
|
||||||
{
|
{
|
||||||
|
$name = (string) $name;
|
||||||
if (isset($this->cache[$name])) {
|
if (isset($this->cache[$name])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -162,6 +163,8 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
|
|||||||
|
|
||||||
protected function findTemplate($name)
|
protected function findTemplate($name)
|
||||||
{
|
{
|
||||||
|
$name = (string) $name;
|
||||||
|
|
||||||
// normalize name
|
// normalize name
|
||||||
$name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/'));
|
$name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/'));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user