]> granicus.if.org Git - php/commitdiff
fix -m argument to mkDir(). Conversion to octal was not being made,
authorGreg Beaver <cellog@php.net>
Mon, 19 Jan 2004 03:32:12 +0000 (03:32 +0000)
committerGreg Beaver <cellog@php.net>
Mon, 19 Jan 2004 03:32:12 +0000 (03:32 +0000)
and a string should never be passed into mkdir().

Thanks to Alex Hayes

pear/System.php

index de49de5c9959df4218ac72b4f2ca8b22cbcf94a7..1d5cd55aed1c67c6cdeaeb3af905f39a23a9be20 100644 (file)
@@ -226,6 +226,14 @@ class System
             if ($opt[0] == 'p') {
                 $create_parents = true;
             } elseif($opt[0] == 'm') {
+                // if the mode is clearly an octal number (starts with 0)
+                // convert it to decimal
+                if (strlen($opt[1]) && $opt[1]{0} == '0') {
+                    $opt[1] = octdec($opt[1]);
+                } else {
+                    // convert to int
+                    $opt[1] += 0;
+                }
                 $mode = $opt[1];
             }
         }