Browse Source

More fixes to avoid segfaults in hhvm

Jose Lorenzo Rodriguez 12 years ago
parent
commit
ec015564f3

+ 1 - 1
src/Cache/Engine/RedisEngine.php

@@ -237,7 +237,7 @@ class RedisEngine extends CacheEngine {
  * Disconnects from the redis server
  */
 	public function __destruct() {
-		if (!$this->_config['persistent']) {
+		if (empty($this->_config['persistent']) && $this->_Redis instanceof \Redis) {
 			$this->_Redis->close();
 		}
 	}

+ 1 - 1
tests/TestCase/Cache/Engine/MemcachedEngineTest.php

@@ -656,7 +656,7 @@ class MemcachedEngineTest extends TestCase {
  * @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_',

+ 1 - 0
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.');
 

+ 1 - 0
tests/TestCase/Network/SocketTest.php

@@ -242,6 +242,7 @@ class SocketTest extends TestCase {
  */
 	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

+ 1 - 1
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 @@ class XmlTest extends TestCase {
  * @return void
  */
 	public function testBuildInvalidData($value) {
+		$this->assertFalse(defined('HHVM_VERSION') && !empty($value), 'Segfaults HHVM');
 		Xml::build($value);
 	}