- bugfix Smarty_Resource::parseResourceName incompatible with Google AppEngine (https://github.com/smarty-php/smarty/issues/22)

This commit is contained in:
Uwe Tews
2015-05-04 22:44:29 +02:00
parent 22ea1404df
commit f14f2dcc6f
3 changed files with 9 additions and 6 deletions

View File

@@ -1,4 +1,7 @@
 ===== 3.1.22-dev ===== (xx.xx.2015)
04.05.2015
- bugfix Smarty_Resource::parseResourceName incompatible with Google AppEngine (https://github.com/smarty-php/smarty/issues/22)
28.04.2015
- bugfix plugins of merged subtemplates not loaded in 3.1.22-dev (forum topic 25508) 2nd fix

View File

@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.22-dev/21';
const SMARTY_VERSION = '3.1.22-dev/22';
/**
* define variable scopes

View File

@@ -218,15 +218,15 @@ abstract class Smarty_Resource
*/
public static function parseResourceName($resource_name, $default_resource)
{
$parts = explode(':', $resource_name, 2);
if (!isset($parts[1]) || !isset($parts[0][1])) {
if (preg_match('/^([A-Za-z0-9_\-]{2,})[:]/', $resource_name, $match)) {
$type = $match[1];
$name = substr($resource_name, strlen($match[0]));
} else {
// no resource given, use default
// or single character before the colon is not a resource type, but part of the filepath
$type = $default_resource;
$name = $resource_name;
} else {
$type = $parts[0];
$name = $parts[1];
}
return array($name, $type);
}