Index: /branches/release-39/php/lib/function.mtinclude.php
===================================================================
--- /branches/release-39/php/lib/function.mtinclude.php (revision 2196)
+++ /branches/release-39/php/lib/function.mtinclude.php (revision 2478)
@@ -231,5 +231,5 @@
         $include_dir = dirname($include_file);
         if (!file_exists($include_dir) && !is_dir($include_dir)) {
-            mkdir($include_dir, 0777, true);
+            mkpath($include_dir, 0777);
         }
         if (is_writable($include_dir)) {
Index: /branches/release-39/php/lib/MTUtil.php
===================================================================
--- /branches/release-39/php/lib/MTUtil.php (revision 2317)
+++ /branches/release-39/php/lib/MTUtil.php (revision 2478)
@@ -1356,5 +1356,5 @@
         $dir_name = dirname($dest);
         if (!file_exists($dir_name)) {
-          mkdir($dir_name, 0777, true);
+          mkpath($dir_name, 0777);
         }
         if (!is_writable($dir_name)) {
@@ -1624,3 +1624,13 @@
 }
 
+function mkpath($path, $mode = 0777) {
+    // PHP5 supports recursive param
+    if (version_compare(PHP_VERSION, '5.0.0', ">="))
+        return mkdir($path, $mode, true);
+
+    // for php4
+    is_dir(dirname($path)) || mkpath(dirname($path), $mode);
+    return is_dir($path) || @mkdir($path, $mode);
+}
+
 ?>
