Replace rtrim with preg_replace in SchemaShell

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.
This commit is contained in:
ovidiupruteanu 2015-05-11 14:35:20 +03:00
parent 6cb21e6dc8
commit 4b3386c16f

View file

@ -158,7 +158,7 @@ class SchemaShell extends AppShell {
}
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();
@ -285,7 +285,7 @@ class SchemaShell extends AppShell {
'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';
}