From b977381e4e7b781fdc57f650369572638e571251 Mon Sep 17 00:00:00 2001 From: rodneyrehm Date: Tue, 14 Aug 2012 13:22:34 +0000 Subject: [PATCH] bugfix PHP5.2 compatibility compromised by SplFileInfo::getBasename() (Issue 110) --- change_log.txt | 3 +++ libs/sysplugins/smarty_internal_cacheresource_file.php | 2 +- libs/sysplugins/smarty_internal_utility.php | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/change_log.txt b/change_log.txt index 56188d6e..e2be9ef1 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +14.08.2012 +- bugfix PHP5.2 compatibility compromised by SplFileInfo::getBasename() (Issue 110) + 01.08.2012 - bugfix avoid PHP error on $smarty->configLoad(...) with invalid section specification (Forum Topic 22608) diff --git a/libs/sysplugins/smarty_internal_cacheresource_file.php b/libs/sysplugins/smarty_internal_cacheresource_file.php index e5d20bd6..04194b39 100644 --- a/libs/sysplugins/smarty_internal_cacheresource_file.php +++ b/libs/sysplugins/smarty_internal_cacheresource_file.php @@ -178,7 +178,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource { $_cacheDirs = new RecursiveDirectoryIterator($_dir); $_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST); foreach ($_cache as $_file) { - if (substr($_file->getBasename(),0,1) == '.' || strpos($_file, '.svn') !== false) continue; + if (substr(basename($_file->getPathname()),0,1) == '.' || strpos($_file, '.svn') !== false) continue; // directory ? if ($_file->isDir()) { if (!$_cache->isDot()) { diff --git a/libs/sysplugins/smarty_internal_utility.php b/libs/sysplugins/smarty_internal_utility.php index 3e362855..e169653f 100644 --- a/libs/sysplugins/smarty_internal_utility.php +++ b/libs/sysplugins/smarty_internal_utility.php @@ -72,7 +72,7 @@ class Smarty_Internal_Utility { $_compileDirs = new RecursiveDirectoryIterator($_dir); $_compile = new RecursiveIteratorIterator($_compileDirs); foreach ($_compile as $_fileinfo) { - if (substr($_fileinfo->getBasename(),0,1) == '.' || strpos($_fileinfo, '.svn') !== false) continue; + if (substr(basename($_file->getPathname()),0,1) == '.' || strpos($_fileinfo, '.svn') !== false) continue; $_file = $_fileinfo->getFilename(); if (!substr_compare($_file, $extention, - strlen($extention)) == 0) continue; if ($_fileinfo->getPath() == substr($_dir, 0, -1)) { @@ -136,7 +136,7 @@ class Smarty_Internal_Utility { $_compileDirs = new RecursiveDirectoryIterator($_dir); $_compile = new RecursiveIteratorIterator($_compileDirs); foreach ($_compile as $_fileinfo) { - if (substr($_fileinfo->getBasename(),0,1) == '.' || strpos($_fileinfo, '.svn') !== false) continue; + if (substr(basename($_fileinfo->getPathname()),0,1) == '.' || strpos($_fileinfo, '.svn') !== false) continue; $_file = $_fileinfo->getFilename(); if (!substr_compare($_file, $extention, - strlen($extention)) == 0) continue; if ($_fileinfo->getPath() == substr($_dir, 0, -1)) { @@ -231,7 +231,7 @@ class Smarty_Internal_Utility { } $_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST); foreach ($_compile as $_file) { - if (substr($_file->getBasename(), 0, 1) == '.' || strpos($_file, '.svn') !== false) + if (substr(basename($_file->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) continue; $_filepath = (string) $_file;