Skip to content

Commit

Permalink
- bugfix Smarty_Resource::parseResourceName incompatible with Google …
Browse files Browse the repository at this point in the history
…AppEngine (#22)
  • Loading branch information
uwetews committed May 4, 2015
1 parent 22ea140 commit f14f2dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion libs/Smarty.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions libs/sysplugins/smarty_resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@ public static function load(Smarty $smarty, $type)
*/
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);
}
Expand Down

0 comments on commit f14f2dc

Please sign in to comment.