From 4de92123fa453f5e5eedd001a8918ad2976436af Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 3 Jan 2016 22:08:09 -0500 Subject: [PATCH 1/2] Back port fixes from #7899 to 2.x Fix XmlView failing when return => domdocument is used. --- lib/Cake/Test/Case/View/XmlViewTest.php | 4 ++-- lib/Cake/View/XmlView.php | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Test/Case/View/XmlViewTest.php b/lib/Cake/Test/Case/View/XmlViewTest.php index 549813730..65a9bdcd4 100644 --- a/lib/Cake/Test/Case/View/XmlViewTest.php +++ b/lib/Cake/Test/Case/View/XmlViewTest.php @@ -107,7 +107,7 @@ class XmlViewTest extends CakeTestCase { $Controller = new Controller($Request, $Response); $data = array( '_serialize' => array('tags'), - '_xmlOptions' => array('format' => 'attributes'), + '_xmlOptions' => array('format' => 'attributes', 'return' => 'domdocument'), 'tags' => array( 'tag' => array( array( @@ -126,7 +126,7 @@ class XmlViewTest extends CakeTestCase { $View = new XmlView($Controller); $result = $View->render(); - $expected = Xml::build(array('response' => array('tags' => $data['tags'])), $data['_xmlOptions'])->asXML(); + $expected = Xml::build(array('response' => array('tags' => $data['tags'])), $data['_xmlOptions'])->saveXML(); $this->assertSame($expected, $result); } diff --git a/lib/Cake/View/XmlView.php b/lib/Cake/View/XmlView.php index 021854fc4..7d7610836 100644 --- a/lib/Cake/View/XmlView.php +++ b/lib/Cake/View/XmlView.php @@ -142,6 +142,9 @@ class XmlView extends View { $options['pretty'] = true; } + if (isset($options['return']) && strtolower($options['return']) === 'domdocument') { + return Xml::fromArray($data, $options)->saveXML(); + } return Xml::fromArray($data, $options)->asXML(); } From 8d472a5d78634aa4c5d2d70c1a6e495fe9f536e1 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Tue, 12 Jan 2016 21:01:14 +0100 Subject: [PATCH 2/2] Memcached can not connect using a socket Fixes #8018 --- lib/Cake/Cache/Engine/MemcachedEngine.php | 5 +++-- lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Cache/Engine/MemcachedEngine.php b/lib/Cake/Cache/Engine/MemcachedEngine.php index 331b8a352..d14b5344f 100644 --- a/lib/Cake/Cache/Engine/MemcachedEngine.php +++ b/lib/Cake/Cache/Engine/MemcachedEngine.php @@ -185,8 +185,9 @@ class MemcachedEngine extends CacheEngine { * @return array Array containing host, port */ protected function _parseServerString($server) { - if (strpos($server, 'unix://') === 0) { - return array($server, 0); + $socketTransport = 'unix://'; + if (strpos($server, $socketTransport) === 0) { + return array(substr($server, strlen($socketTransport)), 0); } if (substr($server, 0, 1) === '[') { $position = strpos($server, ']:'); diff --git a/lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php index 17f1f9972..823c67f44 100644 --- a/lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php @@ -433,7 +433,7 @@ class MemcachedEngineTest extends CakeTestCase { public function testParseServerStringUnix() { $Memcached = new TestMemcachedEngine(); $result = $Memcached->parseServerString('unix:///path/to/memcachedd.sock'); - $this->assertEquals(array('unix:///path/to/memcachedd.sock', 0), $result); + $this->assertEquals(array('/path/to/memcachedd.sock', 0), $result); } /**