Skip to content

Commit cd940ec

Browse files
committed
Handle realpath error conditions
1 parent 6a0d60e commit cd940ec

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=====
33

4+
1.0.14 - 2022/04/24
5+
-----
6+
7+
* Allow installing Textpattern plugins as dependencies outside a Textpattern
8+
installation as a normal library.
9+
410
1.0.13 - 2022/04/22
511
-----
612

src/Textpattern/Composer/Installer/Textpattern/Find.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,26 @@ public function find($directory)
9090
$path = $this->isConfig('./textpattern/config.php');
9191

9292
if ($path !== null) {
93-
return realpath($path);
93+
$path = realpath($path);
94+
95+
if ($path === false) {
96+
return null;
97+
}
98+
99+
return $path;
94100
}
95101

96102
if (!file_exists($directory) || !is_dir($directory) || !is_readable($directory)) {
97103
return null;
98104
}
99105

100-
$iterator = new \RecursiveDirectoryIterator(realpath($directory));
106+
$directory = realpath($directory);
107+
108+
if ($directory === false) {
109+
return null;
110+
}
111+
112+
$iterator = new \RecursiveDirectoryIterator($directory);
101113
$iterator = new \RecursiveIteratorIterator($iterator);
102114

103115
foreach ($iterator as $file) {

0 commit comments

Comments
 (0)