Compare commits

..

7 Commits

Author SHA1 Message Date
Simon Wisselink c2b31f7a90 mental notes 2022-09-22 23:32:10 +02:00
Simon Wisselink 489d647841 whitespace 2022-09-22 23:26:46 +02:00
Simon Wisselink cc113d4eb7 Use smarty_strtolower_ascii in autoloader to. 2022-09-22 23:24:32 +02:00
Simon Wisselink 0a44dca645 Merge branch 'master' into i155-fix 2022-09-22 23:22:41 +02:00
Simon Wisselink 3ce328b6d0 Implemented locale safe strotoupper, strolower and ucfirst functions for translating user string to filenames etc.
Fixes #155
2022-09-22 23:19:04 +02:00
Alec Smecher a3621b375e Update libs/sysplugins/smarty_internal_compile_private_special_variable.php
Fixed variable naming typo (thanks!)

Co-Authored-By: Alexkurd <7689609+Alexkurd@users.noreply.github.com>
2020-04-15 08:30:35 -07:00
Alec Smecher 0124bc3aa0 #155 Adapt Smarty upper/lower functions to be codesafe (e.g. for Turkish locale) 2020-04-14 15:03:31 -07:00
2 changed files with 2 additions and 14 deletions
-1
View File
@@ -17,7 +17,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed PHP8.1 deprecation notices for strftime [#672](https://github.com/smarty-php/smarty/issues/672)
- Fixed PHP8.1 deprecation errors passing null to parameter in trim [#807](https://github.com/smarty-php/smarty/pull/807)
- Adapt Smarty upper/lower functions to be codesafe (e.g. for Turkish locale) [#586](https://github.com/smarty-php/smarty/pull/586)
- Bug fix for underscore and limited length in template name in custom resources [#581](https://github.com/smarty-php/smarty/pull/581)
## [4.2.1] - 2022-09-14
+2 -13
View File
@@ -47,7 +47,7 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource
*/
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
$source->filepath = $source->type . ':' . $this->generateSafeName($source->name);
$source->filepath = $source->type . ':' . substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25);
$source->uid = sha1($source->type . ':' . $source->name);
$mtime = $this->fetchTimestamp($source->name);
if ($mtime !== null) {
@@ -88,17 +88,6 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource
*/
public function getBasename(Smarty_Template_Source $source)
{
return basename($this->generateSafeName($source->name));
}
/**
* Removes special characters from $name and limits its length to 127 characters.
*
* @param $name
*
* @return string
*/
private function generateSafeName($name): string {
return substr(preg_replace('/[^A-Za-z0-9._]/', '', (string) $name), 0, 127);
return basename(substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25));
}
}