Skip to content

Commit

Permalink
Replace rtrim with preg_replace in SchemaShell
Browse files Browse the repository at this point in the history
The second parameter of rtrim is a character mask, not a string to be replaced. It was breaking file names ending in one or more 'p' or 'h' characters.
  • Loading branch information
ovidiupruteanu committed May 11, 2015
1 parent 6cb21e6 commit 4b3386c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Console/Command/SchemaShell.php
Expand Up @@ -158,7 +158,7 @@ public function generate() {
}

if ($snapshot === true) {
$fileName = rtrim($this->params['file'], '.php');
$fileName = preg_replace('`\.php$`', '', $this->params['file'], 1);
$Folder = new Folder($this->Schema->path);
$result = $Folder->read();

Expand Down Expand Up @@ -285,7 +285,7 @@ protected function _loadSchema() {
'connection' => $this->params['connection'],
);
if (!empty($this->params['snapshot'])) {
$fileName = rtrim($this->Schema->file, '.php');
$fileName = preg_replace('`\.php$`', '', $this->Schema->file, 1);
$options['file'] = $fileName . '_' . $this->params['snapshot'] . '.php';
}

Expand Down

0 comments on commit 4b3386c

Please sign in to comment.