Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291167

drupal_mkdir() doesn't work with absolute paths or recursive

$
0
0

When calling with an absolute path, such as '/Users/joachim/bin/drupal_hooks/8', this function returns FALSE.

This is because the call to explode produces an array like this:

Array
(
    [0] =>
    [1] => Users
    [2] => joachim
    [3] => bin
    [4] => drupal_hooks
)

When the directory path is then built up from the pieces, the first one will be an empty string.

For that matter, this looks wrong:

    foreach ($components as $component) {
      $recursive_path .= $component;

because the exploding on DIRECTORY_SEPARATOR means that none of the pieces contain DIRECTORY_SEPARATOR. Therefore, the joining will just smush the pieces together without slashes.


Viewing all articles
Browse latest Browse all 291167

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>