mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding a protection to cake console be executed in driver root (windows). Fixes #1408.
This commit is contained in:
parent
0e7f2efdb1
commit
21a9904a71
2 changed files with 8 additions and 3 deletions
|
@ -501,6 +501,9 @@ class ShellDispatcher {
|
||||||
}
|
}
|
||||||
$params = str_replace('\\', '/', $params);
|
$params = str_replace('\\', '/', $params);
|
||||||
|
|
||||||
|
if (isset($params['working'])) {
|
||||||
|
$params['working'] = trim($params['working']);
|
||||||
|
}
|
||||||
if (!empty($params['working']) && (!isset($this->args[0]) || isset($this->args[0]) && $this->args[0]{0} !== '.')) {
|
if (!empty($params['working']) && (!isset($this->args[0]) || isset($this->args[0]) && $this->args[0]{0} !== '.')) {
|
||||||
if (empty($this->params['app']) && $params['working'] != $params['root']) {
|
if (empty($this->params['app']) && $params['working'] != $params['root']) {
|
||||||
$params['root'] = dirname($params['working']);
|
$params['root'] = dirname($params['working']);
|
||||||
|
@ -516,8 +519,10 @@ class ShellDispatcher {
|
||||||
$params['root'] .= '/' . dirname($params['app']);
|
$params['root'] .= '/' . dirname($params['app']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$params['app'] = basename($params['app']);
|
$params['working'] = rtrim($params['root'], '/');
|
||||||
$params['working'] = rtrim($params['root'], '/') . '/' . $params['app'];
|
if (!$isWin || !preg_match('/^[A-Z]:$/i', $params['app'])) {
|
||||||
|
$params['working'] .= '/' . $params['app'];
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($matches[0]) || !empty($isWin)) {
|
if (!empty($matches[0]) || !empty($isWin)) {
|
||||||
$params = str_replace('/', '\\', $params);
|
$params = str_replace('/', '\\', $params);
|
||||||
|
|
Loading…
Reference in a new issue