From ec015564f3f3fe957e4e4cd265c29f6518f4a13f Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Thu, 13 Feb 2014 15:55:21 +0100 Subject: [PATCH] More fixes to avoid segfaults in hhvm --- src/Cache/Engine/RedisEngine.php | 2 +- tests/TestCase/Cache/Engine/MemcachedEngineTest.php | 2 +- tests/TestCase/Cache/Engine/RedisEngineTest.php | 1 + tests/TestCase/Network/SocketTest.php | 1 + tests/TestCase/Utility/XmlTest.php | 2 +- 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Cache/Engine/RedisEngine.php b/src/Cache/Engine/RedisEngine.php index f99f5d35e25..8ac51c08db8 100644 --- a/src/Cache/Engine/RedisEngine.php +++ b/src/Cache/Engine/RedisEngine.php @@ -237,7 +237,7 @@ public function clearGroup($group) { * Disconnects from the redis server */ public function __destruct() { - if (!$this->_config['persistent']) { + if (empty($this->_config['persistent']) && $this->_Redis instanceof \Redis) { $this->_Redis->close(); } } diff --git a/tests/TestCase/Cache/Engine/MemcachedEngineTest.php b/tests/TestCase/Cache/Engine/MemcachedEngineTest.php index 9bf8b3e3590..462f71acf2d 100644 --- a/tests/TestCase/Cache/Engine/MemcachedEngineTest.php +++ b/tests/TestCase/Cache/Engine/MemcachedEngineTest.php @@ -656,7 +656,7 @@ public function testConfigurationConflict() { * @return void */ public function testClear() { - $this->assertFalse(defined('HHVM_VERSION'), 'Remove me when travis updates hhvm to 2.5'); + $this->assertFalse(defined('HHVM_VERSION'), 'Crashes HHVM'); Cache::config('memcached2', array( 'engine' => 'Memcached', 'prefix' => 'cake2_', diff --git a/tests/TestCase/Cache/Engine/RedisEngineTest.php b/tests/TestCase/Cache/Engine/RedisEngineTest.php index ea8e73022a6..967948770a3 100644 --- a/tests/TestCase/Cache/Engine/RedisEngineTest.php +++ b/tests/TestCase/Cache/Engine/RedisEngineTest.php @@ -33,6 +33,7 @@ class RedisEngineTest extends TestCase { * @return void */ public function setUp() { + $this->assertFalse(defined('HHVM_VERSION'), 'Crashes HHVM'); parent::setUp(); $this->skipIf(!class_exists('Redis'), 'Redis is not installed or configured properly.'); diff --git a/tests/TestCase/Network/SocketTest.php b/tests/TestCase/Network/SocketTest.php index 3e210e40e5e..eddf1613f2e 100644 --- a/tests/TestCase/Network/SocketTest.php +++ b/tests/TestCase/Network/SocketTest.php @@ -242,6 +242,7 @@ public function testReset() { */ public function testEnableCryptoSocketExceptionNoSsl() { $this->skipIf(!extension_loaded('openssl'), 'OpenSSL is not enabled cannot test SSL.'); + $this->assertFalse(defined('HHVM_VERSION'), 'Broken on HHVM'); $configNoSslOrTls = array('host' => 'localhost', 'port' => 80, 'timeout' => 0.1); // testing exception on no ssl socket server for ssl and tls methods diff --git a/tests/TestCase/Utility/XmlTest.php b/tests/TestCase/Utility/XmlTest.php index 483d60f7311..c4a11dec3b1 100644 --- a/tests/TestCase/Utility/XmlTest.php +++ b/tests/TestCase/Utility/XmlTest.php @@ -47,7 +47,6 @@ class XmlTest extends TestCase { * @return void */ public function setUp() { - $this->assertFalse(defined('HHVM_VERSION'), 'Causes segfault on HHVM'); parent::setUp(); $this->_appEncoding = Configure::read('App.encoding'); Configure::write('App.encoding', 'UTF-8'); @@ -137,6 +136,7 @@ public static function invalidDataProvider() { * @return void */ public function testBuildInvalidData($value) { + $this->assertFalse(defined('HHVM_VERSION') && !empty($value), 'Segfaults HHVM'); Xml::build($value); }