From 309aee9fe5d45dd85e01c30352529fd25e333111 Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Thu, 30 Apr 2015 15:18:28 +0200 Subject: [PATCH 01/24] Backport #6431 --- lib/Cake/Network/CakeResponse.php | 1 + lib/Cake/Test/Case/Network/CakeResponseTest.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index 6c8bc2a7e..e6d0bf2b3 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -68,6 +68,7 @@ class CakeResponse { 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', + 429 => 'Too Many Requests', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', diff --git a/lib/Cake/Test/Case/Network/CakeResponseTest.php b/lib/Cake/Test/Case/Network/CakeResponseTest.php index a811b89e5..82a2f0419 100644 --- a/lib/Cake/Test/Case/Network/CakeResponseTest.php +++ b/lib/Cake/Test/Case/Network/CakeResponseTest.php @@ -404,7 +404,7 @@ class CakeResponseTest extends CakeTestCase { public function testHttpCodes() { $response = new CakeResponse(); $result = $response->httpCodes(); - $this->assertEquals(40, count($result)); + $this->assertEquals(41, count($result)); $result = $response->httpCodes(100); $expected = array(100 => 'Continue'); @@ -417,7 +417,7 @@ class CakeResponseTest extends CakeTestCase { $result = $response->httpCodes($codes); $this->assertTrue($result); - $this->assertEquals(42, count($response->httpCodes())); + $this->assertEquals(43, count($response->httpCodes())); $result = $response->httpCodes(381); $expected = array(381 => 'Unicorn Moved'); @@ -426,7 +426,7 @@ class CakeResponseTest extends CakeTestCase { $codes = array(404 => 'Sorry Bro'); $result = $response->httpCodes($codes); $this->assertTrue($result); - $this->assertEquals(42, count($response->httpCodes())); + $this->assertEquals(43, count($response->httpCodes())); $result = $response->httpCodes(404); $expected = array(404 => 'Sorry Bro'); From adf2eb03f27f04f49b9151105daa265b24008bc1 Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Thu, 30 Apr 2015 15:51:13 +0200 Subject: [PATCH 02/24] Backport jsonOptions --- lib/Cake/Test/Case/View/JsonViewTest.php | 25 ++++++++++++++++++++++++ lib/Cake/View/JsonView.php | 23 +++++++++++++++++----- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/lib/Cake/Test/Case/View/JsonViewTest.php b/lib/Cake/Test/Case/View/JsonViewTest.php index 4e4eb2574..aa5027ae1 100644 --- a/lib/Cake/Test/Case/View/JsonViewTest.php +++ b/lib/Cake/Test/Case/View/JsonViewTest.php @@ -194,6 +194,31 @@ class JsonViewTest extends CakeTestCase { $this->assertSame($expected, $output); } +/** + * Test render with _jsonOptions setting. + * + * @return void + */ + public function testRenderWithoutViewJsonOptions() { + $this->skipIf(!version_compare(PHP_VERSION, '5.3.0', '>='), 'Needs PHP5.3+ for these constants to be tested'); + + $Request = new CakeRequest(); + $Response = new CakeResponse(); + $Controller = new Controller($Request, $Response); + + // Test render with encode <, >, ', &, and " for RFC4627-compliant to be serialized. + $data = array('rfc4627_escape' => ' \'quote\' "double-quote" &'); + $serialize = 'rfc4627_escape'; + $expected = json_encode(' \'quote\' "double-quote" &', JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT); + + $Controller->set($data); + $Controller->set('_serialize', $serialize); + $Controller->set('_jsonOptions', JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT); + $View = new JsonView($Controller); + $output = $View->render(false); + + $this->assertSame($expected, $output); + } /** * Test that rendering with _serialize does not load helpers. * diff --git a/lib/Cake/View/JsonView.php b/lib/Cake/View/JsonView.php index 7953803de..26d7e0049 100644 --- a/lib/Cake/View/JsonView.php +++ b/lib/Cake/View/JsonView.php @@ -125,6 +125,10 @@ class JsonView extends View { /** * Serialize view vars * + * ### Special parameters + * `_jsonOptions` You can set custom options for json_encode() this way, + * e.g. `JSON_HEX_TAG | JSON_HEX_APOS`. + * * @param array $serialize The viewVars that need to be serialized * @throws CakeException * @return string The serialized data @@ -145,15 +149,24 @@ class JsonView extends View { $data = isset($this->viewVars[$serialize]) ? $this->viewVars[$serialize] : null; } - if (version_compare(PHP_VERSION, '5.4.0', '>=') && Configure::read('debug')) { - $json = json_encode($data, JSON_PRETTY_PRINT); - } else { - $json = json_encode($data); + $jsonOptions = 0; + if (isset($this->viewVars['_jsonOptions'])) { + if ($this->viewVars['_jsonOptions'] === false) { + $jsonOptions = 0; + } else { + $jsonOptions = $this->viewVars['_jsonOptions']; + } } + if (version_compare(PHP_VERSION, '5.4.0', '>=') && Configure::read('debug')) { + $jsonOptions = $jsonOptions | JSON_PRETTY_PRINT; + } + + $json = json_encode($data, $jsonOptions); if (function_exists('json_last_error') && json_last_error() !== JSON_ERROR_NONE) { throw new CakeException(json_last_error_msg()); - } elseif ($json === false) { + } + if ($json === false) { throw new CakeException('Failed to parse JSON'); } return $json; From ed21f8423658eff738629b351e0896cfed89d1ff Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Sat, 2 May 2015 14:24:02 +0200 Subject: [PATCH 03/24] Backport _xmlOptions --- lib/Cake/Test/Case/View/XmlViewTest.php | 71 +++++++++++++++++++++++++ lib/Cake/View/XmlView.php | 7 +++ 2 files changed, 78 insertions(+) diff --git a/lib/Cake/Test/Case/View/XmlViewTest.php b/lib/Cake/Test/Case/View/XmlViewTest.php index 89399beef..d90c057ae 100644 --- a/lib/Cake/Test/Case/View/XmlViewTest.php +++ b/lib/Cake/Test/Case/View/XmlViewTest.php @@ -96,7 +96,78 @@ class XmlViewTest extends CakeTestCase { $this->assertFalse(isset($View->Html), 'No helper loaded.'); } + /** + * Test that rendering with _serialize respects XML options. + * + * @return void + */ + public function testRenderSerializeWithOptions() { + $Request = new CakeRequest(); + $Response = new CakeResponse(); + $Controller = new Controller($Request, $Response); + $data = [ + '_serialize' => ['tags'], + '_xmlOptions' => ['format' => 'attributes'], + 'tags' => [ + 'tag' => [ + [ + 'id' => '1', + 'name' => 'defect' + ], + [ + 'id' => '2', + 'name' => 'enhancement' + ] + ] + ] + ]; + $Controller->set($data); + $Controller->viewClass = 'Xml'; + $View = new XmlView($Controller); + $result = $View->render(); + + $expected = Xml::build(['response' => ['tags' => $data['tags']]], $data['_xmlOptions'])->asXML(); + $this->assertSame($expected, $result); + } + +/** + * Test that rendering with _serialize can work with string setting. + * + * @return void + */ + public function testRenderSerializeWithString() { + $Request = new CakeRequest(); + $Response = new CakeResponse(); + $Controller = new Controller($Request, $Response); + $data = [ + '_serialize' => 'tags', + '_xmlOptions' => ['format' => 'attributes'], + 'tags' => [ + 'tags' => [ + 'tag' => [ + [ + 'id' => '1', + 'name' => 'defect' + ], + [ + 'id' => '2', + 'name' => 'enhancement' + ] + ] + ] + ] + ]; + $Controller->set($data); + $Controller->viewClass = 'Xml'; + $View = new XmlView($Controller); + $result = $View->render(); + + $expected = Xml::build($data['tags'], $data['_xmlOptions'])->asXML(); + $this->assertSame($expected, $result); + } + + /** * Test render with an array in _serialize * * @return void diff --git a/lib/Cake/View/XmlView.php b/lib/Cake/View/XmlView.php index 385543373..021854fc4 100644 --- a/lib/Cake/View/XmlView.php +++ b/lib/Cake/View/XmlView.php @@ -109,6 +109,10 @@ class XmlView extends View { /** * Serialize view vars. * + * ### Special parameters + * `_xmlOptions` You can set an array of custom options for Xml::fromArray() this way, e.g. + * 'format' as 'attributes' instead of 'tags'. + * * @param array $serialize The viewVars that need to be serialized. * @return string The serialized data */ @@ -131,6 +135,9 @@ class XmlView extends View { } $options = array(); + if (isset($this->viewVars['_xmlOptions'])) { + $options = $this->viewVars['_xmlOptions']; + } if (Configure::read('debug')) { $options['pretty'] = true; } From cdbf5a0decb26531330d1549d9746fb7022b8d71 Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Sat, 2 May 2015 14:26:57 +0200 Subject: [PATCH 04/24] Correct brackets. --- lib/Cake/Test/Case/View/XmlViewTest.php | 52 ++++++++++++------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/Cake/Test/Case/View/XmlViewTest.php b/lib/Cake/Test/Case/View/XmlViewTest.php index d90c057ae..48b2b6741 100644 --- a/lib/Cake/Test/Case/View/XmlViewTest.php +++ b/lib/Cake/Test/Case/View/XmlViewTest.php @@ -106,28 +106,28 @@ class XmlViewTest extends CakeTestCase { $Request = new CakeRequest(); $Response = new CakeResponse(); $Controller = new Controller($Request, $Response); - $data = [ - '_serialize' => ['tags'], - '_xmlOptions' => ['format' => 'attributes'], - 'tags' => [ - 'tag' => [ - [ + $data = array( + '_serialize' => array('tags'), + '_xmlOptions' => array('format' => 'attributes'), + 'tags' => array( + 'tag' => array( + array( 'id' => '1', 'name' => 'defect' - ], - [ + ), + array( 'id' => '2', 'name' => 'enhancement' - ] - ] - ] - ]; + ) + ) + ) + ); $Controller->set($data); $Controller->viewClass = 'Xml'; $View = new XmlView($Controller); $result = $View->render(); - $expected = Xml::build(['response' => ['tags' => $data['tags']]], $data['_xmlOptions'])->asXML(); + $expected = Xml::build(array('response' => array('tags' => $data['tags'])), $data['_xmlOptions'])->asXML(); $this->assertSame($expected, $result); } @@ -140,24 +140,24 @@ class XmlViewTest extends CakeTestCase { $Request = new CakeRequest(); $Response = new CakeResponse(); $Controller = new Controller($Request, $Response); - $data = [ + $data = array( '_serialize' => 'tags', - '_xmlOptions' => ['format' => 'attributes'], - 'tags' => [ - 'tags' => [ - 'tag' => [ - [ + '_xmlOptions' => array('format' => 'attributes'), + 'tags' => array( + 'tags' => array( + 'tag' => array( + array( 'id' => '1', 'name' => 'defect' - ], - [ + ), + array( 'id' => '2', 'name' => 'enhancement' - ] - ] - ] - ] - ]; + ) + ) + ) + ) + ); $Controller->set($data); $Controller->viewClass = 'Xml'; $View = new XmlView($Controller); From 8e618ed9e6d2b4bba5fc9faa525f6efe181b6286 Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Sat, 2 May 2015 14:31:38 +0200 Subject: [PATCH 05/24] Fix documentation regarding attributes --- lib/Cake/Utility/Xml.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Utility/Xml.php b/lib/Cake/Utility/Xml.php index e3bb4282d..0cd5e891b 100644 --- a/lib/Cake/Utility/Xml.php +++ b/lib/Cake/Utility/Xml.php @@ -156,7 +156,7 @@ class Xml { * * ### Options * - * - `format` If create childs ('tags') or attributes ('attribute'). + * - `format` If create childs ('tags') or attributes ('attributes'). * - `pretty` Returns formatted Xml when set to `true`. Defaults to `false` * - `version` Version of XML document. Default is 1.0. * - `encoding` Encoding of XML document. If null remove from XML header. Default is the some of application. @@ -180,7 +180,7 @@ class Xml { * * `1defectdescription` * - * And calling `Xml::fromArray($value, 'attribute');` Will generate: + * And calling `Xml::fromArray($value, 'attributes');` Will generate: * * `description` * @@ -229,7 +229,7 @@ class Xml { * @param DOMDocument $dom Handler to DOMDocument * @param DOMElement $node Handler to DOMElement (child) * @param array &$data Array of data to append to the $node. - * @param string $format Either 'attribute' or 'tags'. This determines where nested keys go. + * @param string $format Either 'attributes' or 'tags'. This determines where nested keys go. * @return void * @throws XmlException */ From f510dac32afa69cf6463919ece2093fdd5134037 Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Sat, 2 May 2015 16:16:27 +0200 Subject: [PATCH 06/24] fix cs --- lib/Cake/Test/Case/View/XmlViewTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/View/XmlViewTest.php b/lib/Cake/Test/Case/View/XmlViewTest.php index 48b2b6741..549813730 100644 --- a/lib/Cake/Test/Case/View/XmlViewTest.php +++ b/lib/Cake/Test/Case/View/XmlViewTest.php @@ -96,7 +96,6 @@ class XmlViewTest extends CakeTestCase { $this->assertFalse(isset($View->Html), 'No helper loaded.'); } - /** * Test that rendering with _serialize respects XML options. * @@ -167,7 +166,7 @@ class XmlViewTest extends CakeTestCase { $this->assertSame($expected, $result); } - /** +/** * Test render with an array in _serialize * * @return void From 6cb21e6dc8b96d5f2e33a8692f4d18ab78dd2ad4 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 10 May 2015 21:34:08 -0400 Subject: [PATCH 07/24] Change default value to allow code coverage on non-app files. Don't default to app, as it prevents generating code coverage for core and plugin files. Fixes #6533 --- lib/Cake/TestSuite/CakeTestSuiteDispatcher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php b/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php index 8b8b1e3ca..d61b232a4 100644 --- a/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php +++ b/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php @@ -37,7 +37,7 @@ class CakeTestSuiteDispatcher { 'codeCoverage' => false, 'case' => null, 'core' => false, - 'app' => true, + 'app' => false, 'plugin' => null, 'output' => 'html', 'show' => 'groups', From 4b3386c16f29147bd4ed5c825ae61b1e664aa8c6 Mon Sep 17 00:00:00 2001 From: ovidiupruteanu Date: Mon, 11 May 2015 14:35:20 +0300 Subject: [PATCH 08/24] 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 09/24] 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'; } From d4740c9c09b622e1827a84d8e9d84a676b570d3b Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 11 May 2015 21:31:11 -0400 Subject: [PATCH 10/24] Fix incorrect handling of irregular values. When inflecting irregular values, both plural and singular forms were generated incorrectly. Fixes #6538 --- lib/Cake/Test/Case/Utility/InflectorTest.php | 3 +++ lib/Cake/Utility/Inflector.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/Utility/InflectorTest.php b/lib/Cake/Test/Case/Utility/InflectorTest.php index caf085ad1..343215098 100644 --- a/lib/Cake/Test/Case/Utility/InflectorTest.php +++ b/lib/Cake/Test/Case/Utility/InflectorTest.php @@ -123,6 +123,7 @@ class InflectorTest extends CakeTestCase { $this->assertEquals(Inflector::singularize('fungi'), 'fungus'); $this->assertEquals(Inflector::singularize('nuclei'), 'nucleus'); $this->assertEquals(Inflector::singularize('octopuses'), 'octopus'); + $this->assertEquals(Inflector::singularize('octopuses'), 'octopus'); $this->assertEquals(Inflector::singularize('radii'), 'radius'); $this->assertEquals(Inflector::singularize('stimuli'), 'stimulus'); $this->assertEquals(Inflector::singularize('syllabi'), 'syllabus'); @@ -178,6 +179,7 @@ class InflectorTest extends CakeTestCase { $this->assertEquals(Inflector::singularize('metadata'), 'metadata'); $this->assertEquals(Inflector::singularize('files_metadata'), 'files_metadata'); $this->assertEquals(Inflector::singularize('sieves'), 'sieve'); + $this->assertEquals(Inflector::singularize('blue_octopuses'), 'blue_octopus'); $this->assertEquals(Inflector::singularize(''), ''); } @@ -250,6 +252,7 @@ class InflectorTest extends CakeTestCase { $this->assertEquals(Inflector::pluralize('files_metadata'), 'files_metadata'); $this->assertEquals(Inflector::pluralize('stadia'), 'stadia'); $this->assertEquals(Inflector::pluralize('sieve'), 'sieves'); + $this->assertEquals(Inflector::pluralize('blue_octopus'), 'blue_octopuses'); $this->assertEquals(Inflector::pluralize(''), ''); } diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index 33e4ecf1c..0d245c517 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -387,7 +387,7 @@ class Inflector { } if (preg_match('/(.*)\\b(' . self::$_plural['cacheIrregular'] . ')$/i', $word, $regs)) { - self::$_cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$_plural['merged']['irregular'][strtolower($regs[2])], 1); + self::$_cache['pluralize'][$word] = $regs[1] . substr($regs[2], 0, 1) . substr(self::$_plural['merged']['irregular'][strtolower($regs[2])], 1); return self::$_cache['pluralize'][$word]; } @@ -436,7 +436,7 @@ class Inflector { } if (preg_match('/(.*)\\b(' . self::$_singular['cacheIrregular'] . ')$/i', $word, $regs)) { - self::$_cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$_singular['merged']['irregular'][strtolower($regs[2])], 1); + self::$_cache['singularize'][$word] = $regs[1] . substr($regs[2], 0, 1) . substr(self::$_singular['merged']['irregular'][strtolower($regs[2])], 1); return self::$_cache['singularize'][$word]; } From 323e8d8d76af3d182b4c3ebe2ac3ae26f28d2b84 Mon Sep 17 00:00:00 2001 From: ndm2 Date: Tue, 12 May 2015 14:33:15 +0200 Subject: [PATCH 11/24] Add underscore support for multi word irregulars. Underscore separated words were not catched by the irregular regex, tests however didn't fail as the default rules matched the tested words too. The added test should ensure that this won't happen again. Fixes the gap left by the previous #6538 fix. --- lib/Cake/Test/Case/Utility/InflectorTest.php | 25 ++++++++++++++++++++ lib/Cake/Utility/Inflector.php | 4 ++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/Utility/InflectorTest.php b/lib/Cake/Test/Case/Utility/InflectorTest.php index 343215098..b621a1920 100644 --- a/lib/Cake/Test/Case/Utility/InflectorTest.php +++ b/lib/Cake/Test/Case/Utility/InflectorTest.php @@ -256,6 +256,31 @@ class InflectorTest extends CakeTestCase { $this->assertEquals(Inflector::pluralize(''), ''); } +/** + * testInflectingMultiWordIrregulars + * + * @return void + */ + public function testInflectingMultiWordIrregulars() { + // unset the default rules in order to avoid them possibly matching + // the words in case the irregular regex won't match, the tests + // should fail in that case + Inflector::rules('plural', array( + 'rules' => array(), + )); + Inflector::rules('singular', array( + 'rules' => array(), + )); + + $this->assertEquals(Inflector::singularize('wisdom teeth'), 'wisdom tooth'); + $this->assertEquals(Inflector::singularize('wisdom-teeth'), 'wisdom-tooth'); + $this->assertEquals(Inflector::singularize('wisdom_teeth'), 'wisdom_tooth'); + + $this->assertEquals(Inflector::pluralize('sweet potato'), 'sweet potatoes'); + $this->assertEquals(Inflector::pluralize('sweet-potato'), 'sweet-potatoes'); + $this->assertEquals(Inflector::pluralize('sweet_potato'), 'sweet_potatoes'); + } + /** * testInflectorSlug method * diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index 0d245c517..594556b60 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -386,7 +386,7 @@ class Inflector { self::$_plural['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$_plural['merged']['irregular'])) . ')'; } - if (preg_match('/(.*)\\b(' . self::$_plural['cacheIrregular'] . ')$/i', $word, $regs)) { + if (preg_match('/(.*(?:\\b|_))(' . self::$_plural['cacheIrregular'] . ')$/i', $word, $regs)) { self::$_cache['pluralize'][$word] = $regs[1] . substr($regs[2], 0, 1) . substr(self::$_plural['merged']['irregular'][strtolower($regs[2])], 1); return self::$_cache['pluralize'][$word]; } @@ -435,7 +435,7 @@ class Inflector { self::$_singular['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$_singular['merged']['irregular'])) . ')'; } - if (preg_match('/(.*)\\b(' . self::$_singular['cacheIrregular'] . ')$/i', $word, $regs)) { + if (preg_match('/(.*(?:\\b|_))(' . self::$_singular['cacheIrregular'] . ')$/i', $word, $regs)) { self::$_cache['singularize'][$word] = $regs[1] . substr($regs[2], 0, 1) . substr(self::$_singular['merged']['irregular'][strtolower($regs[2])], 1); return self::$_cache['singularize'][$word]; } From 6ffc9670d2a238c57fca1bf84e6743967c210223 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 13 May 2015 22:34:46 -0400 Subject: [PATCH 12/24] Document missing option in loadAll(). --- lib/Cake/Core/CakePlugin.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Core/CakePlugin.php b/lib/Cake/Core/CakePlugin.php index 96ce894fd..5f30887f4 100644 --- a/lib/Cake/Core/CakePlugin.php +++ b/lib/Cake/Core/CakePlugin.php @@ -48,8 +48,13 @@ class CakePlugin { * * It is also possible to load multiple plugins at once. Examples: * - * `CakePlugin::load(array('DebugKit', 'ApiGenerator'))` will load the DebugKit and ApiGenerator plugins - * `CakePlugin::load(array('DebugKit', 'ApiGenerator'), array('bootstrap' => true))` will load bootstrap file for both plugins + * `CakePlugin::load(array('DebugKit', 'ApiGenerator'))` + * + * will load the DebugKit and ApiGenerator plugins + * + * `CakePlugin::load(array('DebugKit', 'ApiGenerator'), array('bootstrap' => true))` + * + * will load bootstrap file for both plugins * * ``` * CakePlugin::load(array( @@ -107,13 +112,26 @@ class CakePlugin { * * ``` * CakePlugin::loadAll(array( - * array('bootstrap' => true), + * array('bootstrap' => true), * 'DebugKit' => array('routes' => true, 'bootstrap' => false), * )) * ``` * * The above example will load the bootstrap file for all plugins, but for DebugKit it will only load - * the routes file and will not look for any bootstrap script. + * the routes file and will not look for any bootstrap script. If you are loading + * many plugins that inconsistently support routes/bootstrap files, instead of detailing + * each plugin you can use the `ignoreMissing` option: + * + * ``` + * CakePlugin::loadAll(array( + * 'ignoreMissing' => true, + * 'bootstrap' => true, + * 'routes' => true, + * )); + * ``` + * + * The ignoreMissing option will do additional file_exists() calls but is simpler + * to use. * * @param array $options Options list. See CakePlugin::load() for valid options. * @return void From 29747995dc6f2fdb2b82767eb3c68cba4fd0048d Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Mon, 18 May 2015 18:10:02 +0200 Subject: [PATCH 13/24] Add missing minimizable HTML attributes --- lib/Cake/View/Helper.php | 45 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/lib/Cake/View/Helper.php b/lib/Cake/View/Helper.php index e91299e73..35aefff44 100644 --- a/lib/Cake/View/Helper.php +++ b/lib/Cake/View/Helper.php @@ -145,9 +145,48 @@ class Helper extends Object { * @var array */ protected $_minimizedAttributes = array( - 'compact', 'checked', 'declare', 'readonly', 'disabled', 'selected', - 'defer', 'ismap', 'nohref', 'noshade', 'nowrap', 'multiple', 'noresize', - 'autoplay', 'controls', 'loop', 'muted', 'required', 'novalidate', 'formnovalidate' + 'allowfullscreen', + 'async', + 'autofocus', + 'autoplay', + 'checked', + 'compact', + 'controls', + 'declare', + 'default', + 'defaultchecked', + 'defaultmuted', + 'defaultselected', + 'defer', + 'disabled', + 'enabled', + 'formnovalidate', + 'hidden', + 'indeterminate', + 'inert', + 'ismap', + 'itemscope', + 'loop', + 'multiple', + 'muted', + 'nohref', + 'noresize', + 'noshade', + 'novalidate', + 'nowrap', + 'open', + 'pauseonexit', + 'readonly', + 'required', + 'reversed', + 'scoped', + 'seamless', + 'selected', + 'sortable', + 'spellcheck', + 'truespeed', + 'typemustmatch', + 'visible' ); /** From 52a0d642ec36a9a3f50bfc5339aa73b3eecfbe8d Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 20 May 2015 22:22:38 -0400 Subject: [PATCH 14/24] Fix incorrectly quoted table aliases in virtual fields. DboSource::_quoteFields() is already a bit of a mess, and while I'm not happy about having to add more regex replacement, it seems to be the only reasonable solution given that the code is already 'parsing' SQL to apply identifier quoting. Fixes #6602 --- lib/Cake/Model/Datasource/DboSource.php | 7 +++++ lib/Cake/Test/Case/Model/ModelReadTest.php | 32 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 80c351202..2e8e6574c 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -2869,12 +2869,19 @@ class DboSource extends DataSource { if (!empty($this->endQuote)) { $end = preg_quote($this->endQuote); } + // Remove quotes and requote all the Model.field names. $conditions = str_replace(array($start, $end), '', $conditions); $conditions = preg_replace_callback( '/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9_][a-z0-9\\-_]*\\.[a-z0-9_][a-z0-9_\\-]*)/i', array(&$this, '_quoteMatchedField'), $conditions ); + // Quote `table_name AS Alias` + $conditions = preg_replace( + '/(\s[a-z0-9\\-_.' . $start . $end . ']*' . $end . ')\s+AS\s+([a-z0-9\\-_]+)/i', + '\1 AS ' . $this->startQuote . '\2' . $this->endQuote, + $conditions + ); if ($conditions !== null) { return $conditions; } diff --git a/lib/Cake/Test/Case/Model/ModelReadTest.php b/lib/Cake/Test/Case/Model/ModelReadTest.php index b684f06d0..7a29cbc37 100644 --- a/lib/Cake/Test/Case/Model/ModelReadTest.php +++ b/lib/Cake/Test/Case/Model/ModelReadTest.php @@ -7836,6 +7836,38 @@ class ModelReadTest extends BaseModelTest { $this->assertEquals(4, $result); } +/** + * Test virtualfields that contain subqueries get correctly + * quoted allowing reserved words to be used. + * + * @return void + */ + public function testVirtualFieldSubqueryReservedWords() { + $this->loadFixtures('User'); + $user = ClassRegistry::init('User'); + $user->cacheMethods = false; + $ds = $user->getDataSource(); + + $sub = $ds->buildStatement( + array( + 'fields' => array('Table.user'), + 'table' => $ds->fullTableName($user), + 'alias' => 'Table', + 'limit' => 1, + 'conditions' => array( + "Table.id > 1" + ) + ), + $user + ); + $user->virtualFields = array( + 'sub_test' => $sub + ); + + $result = $user->field('sub_test', array('id' => 1)); + $this->assertNotEmpty($result); + } + /** * testVirtualFieldsOrder() * From 4a3b2e2a031b037c1b3f2e91df76e210aaaadddd Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 21 May 2015 21:58:12 -0400 Subject: [PATCH 15/24] Fix failing test in SQLite. SQLite does not handle subqueries in virtual fields well. However, the original issue was that the generated query was invalid which find(first) will still catch. --- lib/Cake/Test/Case/Model/ModelReadTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/Model/ModelReadTest.php b/lib/Cake/Test/Case/Model/ModelReadTest.php index 7a29cbc37..255371253 100644 --- a/lib/Cake/Test/Case/Model/ModelReadTest.php +++ b/lib/Cake/Test/Case/Model/ModelReadTest.php @@ -7864,7 +7864,7 @@ class ModelReadTest extends BaseModelTest { 'sub_test' => $sub ); - $result = $user->field('sub_test', array('id' => 1)); + $result = $user->find('first'); $this->assertNotEmpty($result); } From 15f88533e894708b5adf7c2cd9e396b9da9a75c3 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 24 May 2015 21:01:09 -0400 Subject: [PATCH 16/24] Update version number to 2.6.5 --- lib/Cake/VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/VERSION.txt b/lib/Cake/VERSION.txt index 0a2a95a2b..96fbfb435 100644 --- a/lib/Cake/VERSION.txt +++ b/lib/Cake/VERSION.txt @@ -17,4 +17,4 @@ // @license http://www.opensource.org/licenses/mit-license.php MIT License // +--------------------------------------------------------------------------------------------+ // //////////////////////////////////////////////////////////////////////////////////////////////////// -2.6.4 +2.6.5 From 8ebc9cdd875f144a734d43978d618400962c5e58 Mon Sep 17 00:00:00 2001 From: nojimage Date: Mon, 25 May 2015 22:10:50 +0900 Subject: [PATCH 17/24] refs #6635 FormHelper::radio() return collect id attributes with multibyte --- .../Test/Case/View/Helper/FormHelperTest.php | 19 +++++++++++++++++++ lib/Cake/Utility/Inflector.php | 7 ++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index bd0dbb2c8..a1ef2cd9e 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -3902,6 +3902,25 @@ class FormHelperTest extends CakeTestCase { '/fieldset' ); $this->assertTags($result, $expected); + + $result = $this->Form->radio( + 'Model.multibyte', + array('男性' => '男性') + ); + $expected = array( + 'input' => array( + 'type' => 'hidden', 'name' => 'data[Model][multibyte]', + 'id' => 'ModelMultibyte_', 'value' => '', + ), + array('input' => array( + 'type' => 'radio', 'name' => 'data[Model][multibyte]', + 'id' => 'ModelMultibyte男性', 'value' => '男性') + ), + array('label' => array('for' => 'ModelMultibyte男性')), + '男性', + '/label', + ); + $this->assertTags($result, $expected); } /** diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index 594556b60..426334fa5 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -495,7 +495,12 @@ class Inflector { */ public static function humanize($lowerCaseAndUnderscoredWord) { if (!($result = self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) { - $result = ucwords(str_replace('_', ' ', $lowerCaseAndUnderscoredWord)); + $result = str_replace('_', ' ', $lowerCaseAndUnderscoredWord); + if (function_exists('mb_convert_case') && Multibyte::checkMultibyte($result)) { + $result = mb_convert_case($result, MB_CASE_TITLE, Configure::read('App.encoding')); + } else { + $result = ucwords($result); + } self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord, $result); } return $result; From c6e4208bda27115d03148d4191c0d96baff8e61c Mon Sep 17 00:00:00 2001 From: nojimage Date: Tue, 26 May 2015 13:29:05 +0900 Subject: [PATCH 18/24] refs #6635 Inflector::underscore, humanize support multibyte string inputs --- lib/Cake/Test/Case/Utility/InflectorTest.php | 4 ++++ lib/Cake/Utility/Inflector.php | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/Utility/InflectorTest.php b/lib/Cake/Test/Case/Utility/InflectorTest.php index b621a1920..c1abaf15a 100644 --- a/lib/Cake/Test/Case/Utility/InflectorTest.php +++ b/lib/Cake/Test/Case/Utility/InflectorTest.php @@ -399,12 +399,14 @@ class InflectorTest extends CakeTestCase { $this->assertSame(Inflector::underscore('testThing'), 'test_thing'); $this->assertSame(Inflector::underscore('TestThingExtra'), 'test_thing_extra'); $this->assertSame(Inflector::underscore('testThingExtra'), 'test_thing_extra'); + $this->assertSame(Inflector::underscore('testThingExtrå'), 'test_thing_extrå'); // Identical checks test the cache code path. $this->assertSame(Inflector::underscore('TestThing'), 'test_thing'); $this->assertSame(Inflector::underscore('testThing'), 'test_thing'); $this->assertSame(Inflector::underscore('TestThingExtra'), 'test_thing_extra'); $this->assertSame(Inflector::underscore('testThingExtra'), 'test_thing_extra'); + $this->assertSame(Inflector::underscore('testThingExtrå'), 'test_thing_extrå'); // Test stupid values $this->assertSame(Inflector::underscore(''), ''); @@ -457,6 +459,8 @@ class InflectorTest extends CakeTestCase { $this->assertEquals(Inflector::humanize('posts'), 'Posts'); $this->assertEquals(Inflector::humanize('posts_tags'), 'Posts Tags'); $this->assertEquals(Inflector::humanize('file_systems'), 'File Systems'); + $this->assertEquals(Inflector::humanize('hello_wörld'), 'Hello Wörld'); + $this->assertEquals(Inflector::humanize('福岡_city'), '福岡 City'); } /** diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index 426334fa5..79eb448f3 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -479,7 +479,12 @@ class Inflector { */ public static function underscore($camelCasedWord) { if (!($result = self::_cache(__FUNCTION__, $camelCasedWord))) { - $result = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $camelCasedWord)); + $underscoredWord = preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $camelCasedWord); + if (function_exists('mb_convert_case')) { + $result = mb_convert_case($underscoredWord, MB_CASE_LOWER, Configure::read('App.encoding')); + } else { + $result = strtolower($underscoredWord); + } self::_cache(__FUNCTION__, $camelCasedWord, $result); } return $result; @@ -495,8 +500,9 @@ class Inflector { */ public static function humanize($lowerCaseAndUnderscoredWord) { if (!($result = self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) { + $lowerCaseAndUnderscoredWord = self::underscore($lowerCaseAndUnderscoredWord); $result = str_replace('_', ' ', $lowerCaseAndUnderscoredWord); - if (function_exists('mb_convert_case') && Multibyte::checkMultibyte($result)) { + if (function_exists('mb_convert_case')) { $result = mb_convert_case($result, MB_CASE_TITLE, Configure::read('App.encoding')); } else { $result = ucwords($result); From bf550d13ceb785feb745dd143544d1c2e53521ea Mon Sep 17 00:00:00 2001 From: Igor Padovan da Silva Date: Tue, 26 May 2015 17:46:08 -0400 Subject: [PATCH 19/24] preventing error on trying to delete unexiting buffer --- lib/Cake/Network/CakeResponse.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index e6d0bf2b3..d10814003 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -1496,9 +1496,10 @@ class CakeResponse { * @return bool */ protected function _clearBuffer() { - //@codingStandardsIgnoreStart - return @ob_end_clean(); - //@codingStandardsIgnoreEnd + if (ob_get_length()) { + return ob_end_clean(); + } + return true; } /** From 733ddc7ff447bbb6ed036363b951768ca402fccb Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 26 May 2015 22:51:00 -0400 Subject: [PATCH 20/24] Use mb* functions in Inflector humanize/underscore. Use the mbstring shims we already provide to make Inflector more robust than it currently is. This solves the invalid ID attribute generation in a way that never varies between environments. Refs #6635 --- lib/Cake/Utility/Inflector.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index 79eb448f3..61a63c2a1 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -480,11 +480,7 @@ class Inflector { public static function underscore($camelCasedWord) { if (!($result = self::_cache(__FUNCTION__, $camelCasedWord))) { $underscoredWord = preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $camelCasedWord); - if (function_exists('mb_convert_case')) { - $result = mb_convert_case($underscoredWord, MB_CASE_LOWER, Configure::read('App.encoding')); - } else { - $result = strtolower($underscoredWord); - } + $result = mb_strtolower($underscoredWord); self::_cache(__FUNCTION__, $camelCasedWord, $result); } return $result; @@ -501,12 +497,11 @@ class Inflector { public static function humanize($lowerCaseAndUnderscoredWord) { if (!($result = self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) { $lowerCaseAndUnderscoredWord = self::underscore($lowerCaseAndUnderscoredWord); - $result = str_replace('_', ' ', $lowerCaseAndUnderscoredWord); - if (function_exists('mb_convert_case')) { - $result = mb_convert_case($result, MB_CASE_TITLE, Configure::read('App.encoding')); - } else { - $result = ucwords($result); + $result = explode(' ', str_replace('_', ' ', $lowerCaseAndUnderscoredWord)); + foreach ($result as &$word) { + $word = mb_strtoupper(mb_substr($word, 0, 1)) . mb_substr($word, 1); } + $result = implode(' ', $result); self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord, $result); } return $result; From 995d8d22c696eba27e8d1542ea4070a85afef1ea Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 27 May 2015 09:45:53 -0400 Subject: [PATCH 21/24] Disable reading XML files and URLs when handling user data. Allowing users to load arbitrary files/URLs with Xml is not desirable when handing user input. --- .../Component/RequestHandlerComponent.php | 2 +- lib/Cake/Test/Case/Utility/XmlTest.php | 22 +++++++++++++++++++ lib/Cake/Utility/Xml.php | 8 +++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Controller/Component/RequestHandlerComponent.php b/lib/Cake/Controller/Component/RequestHandlerComponent.php index 9d5581487..75bf26486 100644 --- a/lib/Cake/Controller/Component/RequestHandlerComponent.php +++ b/lib/Cake/Controller/Component/RequestHandlerComponent.php @@ -229,7 +229,7 @@ class RequestHandlerComponent extends Component { */ public function convertXml($xml) { try { - $xml = Xml::build($xml); + $xml = Xml::build($xml, ['readFile' => false]); if (isset($xml->data)) { return Xml::toArray($xml->data); } diff --git a/lib/Cake/Test/Case/Utility/XmlTest.php b/lib/Cake/Test/Case/Utility/XmlTest.php index 273801892..d97014445 100644 --- a/lib/Cake/Test/Case/Utility/XmlTest.php +++ b/lib/Cake/Test/Case/Utility/XmlTest.php @@ -167,6 +167,28 @@ class XmlTest extends CakeTestCase { $this->assertNotRegExp('/encoding/', $obj->saveXML()); } +/** + * Test that the readFile option disables local file parsing. + * + * @expectedException XmlException + * @return void + */ + public function testBuildFromFileWhenDisabled() { + $xml = CAKE . 'Test' . DS . 'Fixture' . DS . 'sample.xml'; + $obj = Xml::build($xml, ['readFile' => false]); + } + +/** + * Test that the readFile option disables local file parsing. + * + * @expectedException XmlException + * @return void + */ + public function testBuildFromUrlWhenDisabled() { + $xml = 'http://www.google.com'; + $obj = Xml::build($xml, ['readFile' => false]); + } + /** * data provider function for testBuildInvalidData * diff --git a/lib/Cake/Utility/Xml.php b/lib/Cake/Utility/Xml.php index 0cd5e891b..74d88494d 100644 --- a/lib/Cake/Utility/Xml.php +++ b/lib/Cake/Utility/Xml.php @@ -77,6 +77,9 @@ class Xml { * - `return` Can be 'simplexml' to return object of SimpleXMLElement or 'domdocument' to return DOMDocument. * - `loadEntities` Defaults to false. Set to true to enable loading of ` 'simplexml', 'loadEntities' => false, + 'readFile' => true ); $options += $defaults; @@ -98,9 +102,9 @@ class Xml { return self::fromArray((array)$input, $options); } elseif (strpos($input, '<') !== false) { return self::_loadXml($input, $options); - } elseif (file_exists($input)) { + } elseif ($options['readFile'] && file_exists($input)) { return self::_loadXml(file_get_contents($input), $options); - } elseif (strpos($input, 'http://') === 0 || strpos($input, 'https://') === 0) { + } elseif ($options['readFile'] && strpos($input, 'http://') === 0 || strpos($input, 'https://') === 0) { try { $socket = new HttpSocket(array('request' => array('redirect' => 10))); $response = $socket->get($input); From b66c1ce53c6393258d4f4ec59366e3600689d42b Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 28 May 2015 09:50:27 -0400 Subject: [PATCH 22/24] Update version number to 2.6.6 --- lib/Cake/VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/VERSION.txt b/lib/Cake/VERSION.txt index 96fbfb435..52d4c9832 100644 --- a/lib/Cake/VERSION.txt +++ b/lib/Cake/VERSION.txt @@ -17,4 +17,4 @@ // @license http://www.opensource.org/licenses/mit-license.php MIT License // +--------------------------------------------------------------------------------------------+ // //////////////////////////////////////////////////////////////////////////////////////////////////// -2.6.5 +2.6.6 From 65691836befd5f7abfcb2846a06bf532d543eb3c Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 28 May 2015 17:39:52 -0400 Subject: [PATCH 23/24] Fix syntax errors in PHP <5.4 --- lib/Cake/Controller/Component/RequestHandlerComponent.php | 2 +- lib/Cake/Test/Case/Utility/XmlTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Controller/Component/RequestHandlerComponent.php b/lib/Cake/Controller/Component/RequestHandlerComponent.php index 75bf26486..271b56773 100644 --- a/lib/Cake/Controller/Component/RequestHandlerComponent.php +++ b/lib/Cake/Controller/Component/RequestHandlerComponent.php @@ -229,7 +229,7 @@ class RequestHandlerComponent extends Component { */ public function convertXml($xml) { try { - $xml = Xml::build($xml, ['readFile' => false]); + $xml = Xml::build($xml, array('readFile' => false)); if (isset($xml->data)) { return Xml::toArray($xml->data); } diff --git a/lib/Cake/Test/Case/Utility/XmlTest.php b/lib/Cake/Test/Case/Utility/XmlTest.php index d97014445..614a22a05 100644 --- a/lib/Cake/Test/Case/Utility/XmlTest.php +++ b/lib/Cake/Test/Case/Utility/XmlTest.php @@ -175,7 +175,7 @@ class XmlTest extends CakeTestCase { */ public function testBuildFromFileWhenDisabled() { $xml = CAKE . 'Test' . DS . 'Fixture' . DS . 'sample.xml'; - $obj = Xml::build($xml, ['readFile' => false]); + $obj = Xml::build($xml, array('readFile' => false)); } /** @@ -186,7 +186,7 @@ class XmlTest extends CakeTestCase { */ public function testBuildFromUrlWhenDisabled() { $xml = 'http://www.google.com'; - $obj = Xml::build($xml, ['readFile' => false]); + $obj = Xml::build($xml, array('readFile' => false)); } /** From 523597df432e645b582f0b9c44e8a2464ea71048 Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 28 May 2015 19:30:33 -0400 Subject: [PATCH 24/24] Update version number to 2.6.7 --- lib/Cake/VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/VERSION.txt b/lib/Cake/VERSION.txt index 52d4c9832..ed91c106a 100644 --- a/lib/Cake/VERSION.txt +++ b/lib/Cake/VERSION.txt @@ -17,4 +17,4 @@ // @license http://www.opensource.org/licenses/mit-license.php MIT License // +--------------------------------------------------------------------------------------------+ // //////////////////////////////////////////////////////////////////////////////////////////////////// -2.6.6 +2.6.7