From 4b3386c16f29147bd4ed5c825ae61b1e664aa8c6 Mon Sep 17 00:00:00 2001 From: ovidiupruteanu Date: Mon, 11 May 2015 14:35:20 +0300 Subject: [PATCH 1/2] 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. --- lib/Cake/Console/Command/SchemaShell.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Console/Command/SchemaShell.php b/lib/Cake/Console/Command/SchemaShell.php index 6f77220d8..adb9ff4cd 100644 --- a/lib/Cake/Console/Command/SchemaShell.php +++ b/lib/Cake/Console/Command/SchemaShell.php @@ -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'; } From a55685c278ea2d7d035691be45534c68d41c6117 Mon Sep 17 00:00:00 2001 From: ovidiupruteanu Date: Mon, 11 May 2015 14:52:31 +0300 Subject: [PATCH 2/2] Replace preg_replace with basename in SchemaShell --- lib/Cake/Console/Command/SchemaShell.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Console/Command/SchemaShell.php b/lib/Cake/Console/Command/SchemaShell.php index adb9ff4cd..7648d924a 100644 --- a/lib/Cake/Console/Command/SchemaShell.php +++ b/lib/Cake/Console/Command/SchemaShell.php @@ -158,7 +158,7 @@ class SchemaShell extends AppShell { } if ($snapshot === true) { - $fileName = preg_replace('`\.php$`', '', $this->params['file'], 1); + $fileName = basename($this->params['file'], '.php'); $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 = preg_replace('`\.php$`', '', $this->Schema->file, 1); + $fileName = basename($this->Schema->file, '.php'); $options['file'] = $fileName . '_' . $this->params['snapshot'] . '.php'; }