diff --git a/backup/util/xml/parser/progressive_parser.class.php b/backup/util/xml/parser/progressive_parser.class.php index 91bc85fc4b2..8b6df4b5ee9 100644 --- a/backup/util/xml/parser/progressive_parser.class.php +++ b/backup/util/xml/parser/progressive_parser.class.php @@ -149,7 +149,15 @@ class progressive_parser { * handling parser paths, see MDL-24381 */ public static function dirname($path) { - return str_replace('\\', '/', dirname($path)); + static $cache = array(); + + if (!isset($cache[$path])) { + if (count($cache) > 4096) + $cache = array(); + $cache[$path] = str_replace('\\', '/', dirname($path)); + } + + return $cache[$path]; } // Protected API starts here