Permalink
Browse files

Adding a protection to cake console be executed in driver root (windo…

…ws). Fixes #1408.
  • Loading branch information...
1 parent 0e7f2ef commit 21a9904a71b24e753049a31a47b6dab26fde6743 @jrbasso jrbasso committed Feb 21, 2011
Showing with 8 additions and 3 deletions.
  1. +1 −1 cake/console/cake.bat
  2. +7 −2 cake/console/cake.php
View
2 cake/console/cake.bat
@@ -26,7 +26,7 @@
SET app=%0
SET lib=%~dp0
-php -q "%lib%cake.php" -working "%CD%" %*
+php -q "%lib%cake.php" -working "%CD% " %*
echo.
View
9 cake/console/cake.php
@@ -501,6 +501,9 @@ function parseParams($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($this->params['app']) && $params['working'] != $params['root']) {
$params['root'] = dirname($params['working']);
@@ -516,8 +519,10 @@ function parseParams($params) {
$params['root'] .= '/' . dirname($params['app']);
}
- $params['app'] = basename($params['app']);
- $params['working'] = rtrim($params['root'], '/') . '/' . $params['app'];
@Theaxiom
Theaxiom Apr 9, 2011

This change broke the -app param in shell, using Ubuntu Server 10.10.

@ADmad
ADmad Apr 10, 2011

Thats already fixed in e277324

@Theaxiom
Theaxiom Apr 10, 2011

It's broken, trust me. :)

@jrbasso
jrbasso Apr 10, 2011

Theaxiom, it was fixed (comment of ADmad) after the release 1.3.8 (current master version).

@ADmad
ADmad Apr 10, 2011

I suggest you test against the 1.3 branch HEAD and trust the results you get.

+ $params['working'] = rtrim($params['root'], '/');
+ if (!$isWin || !preg_match('/^[A-Z]:$/i', $params['app'])) {
+ $params['working'] .= '/' . $params['app'];
+ }
if (!empty($matches[0]) || !empty($isWin)) {
$params = str_replace('/', '\\', $params);

0 comments on commit 21a9904

Please sign in to comment.