Skip to content

Commit 4d57d3c

Browse files
committed
Fix plugin path filtering when directories do not exist.
When paths do not exist we should correctly remove them from the output paths. Fixes #2748
1 parent 605351d commit 4d57d3c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/Cake/Console/Command/Task/PluginTask.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,11 @@ public function findPath($pathOptions) {
191191
$valid = false;
192192
foreach ($pathOptions as $i => $path) {
193193
if (!is_dir($path)) {
194-
array_splice($pathOptions, $i, 1);
194+
unset($pathOptions[$i]);
195195
}
196196
}
197+
$pathOptions = array_values($pathOptions);
198+
197199
$max = count($pathOptions);
198200
while (!$valid) {
199201
foreach ($pathOptions as $i => $option) {

lib/Cake/Test/Case/Console/Command/Task/PluginTaskTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ public function testExecuteWithOneArg() {
185185
public function testFindPathNonExistant() {
186186
$paths = App::path('plugins');
187187
$last = count($paths);
188-
$paths[] = '/fake/path';
188+
189+
array_unshift($paths, '/fake/path');
190+
$paths[] = '/fake/path2';
189191

190192
$this->Task = $this->getMock('PluginTask',
191193
array('in', 'out', 'err', 'createFile', '_stop'),

0 commit comments

Comments
 (0)