Skip to content

Commit

Permalink
Handle realpath error conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
gocom committed Apr 23, 2022
1 parent 6a0d60e commit cd940ec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=====

1.0.14 - 2022/04/24
-----

* Allow installing Textpattern plugins as dependencies outside a Textpattern
installation as a normal library.

1.0.13 - 2022/04/22
-----

Expand Down
16 changes: 14 additions & 2 deletions src/Textpattern/Composer/Installer/Textpattern/Find.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,26 @@ public function find($directory)
$path = $this->isConfig('./textpattern/config.php');

if ($path !== null) {
return realpath($path);
$path = realpath($path);

if ($path === false) {
return null;
}

return $path;
}

if (!file_exists($directory) || !is_dir($directory) || !is_readable($directory)) {
return null;
}

$iterator = new \RecursiveDirectoryIterator(realpath($directory));
$directory = realpath($directory);

if ($directory === false) {
return null;
}

$iterator = new \RecursiveDirectoryIterator($directory);
$iterator = new \RecursiveIteratorIterator($iterator);

foreach ($iterator as $file) {
Expand Down

0 comments on commit cd940ec

Please sign in to comment.