Skip to content
Permalink
Browse files

[Cache] skip igbinary on PHP 7.4.0

  • Loading branch information
nicolas-grekas committed Sep 20, 2019
1 parent b4e2ba2 commit 2c0c131142b8de5a6df1827f0bcfd7f6908ab86b
@@ -25,9 +25,9 @@ class DefaultMarshaller implements MarshallerInterface
public function __construct(bool $useIgbinarySerialize = null)
{
if (null === $useIgbinarySerialize) {
$useIgbinarySerialize = \extension_loaded('igbinary');
} elseif ($useIgbinarySerialize && !\extension_loaded('igbinary')) {
throw new CacheException('The "igbinary" PHP extension is not loaded.');
$useIgbinarySerialize = \extension_loaded('igbinary') && \PHP_VERSION_ID !== 70400;
} elseif ($useIgbinarySerialize && (!\extension_loaded('igbinary') || \PHP_VERSION_ID === 70400)) {
throw new CacheException('The "igbinary" PHP extension is not '.(\PHP_VERSION_ID === 70400 ? 'compatible with PHP 7.4.0.' : 'loaded.'));
}
$this->useIgbinarySerialize = $useIgbinarySerialize;
}
@@ -66,7 +66,7 @@ public function unmarshall(string $value)
return null;
}
static $igbinaryNull;
if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') ? igbinary_serialize(null) : false)) {
if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') && \PHP_VERSION_ID !== 70400 ? igbinary_serialize(null) : false)) {
return null;
}
$unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
@@ -24,7 +24,7 @@ public function testSerialize()
'b' => function () {},
];

$expected = ['a' => \extension_loaded('igbinary') ? igbinary_serialize(123) : serialize(123)];
$expected = ['a' => \extension_loaded('igbinary') && \PHP_VERSION_ID !== 70400 ? igbinary_serialize(123) : serialize(123)];
$this->assertSame($expected, $marshaller->marshall($values, $failed));
$this->assertSame(['b'], $failed);
}
@@ -43,6 +43,10 @@ public function testNativeUnserialize()
*/
public function testIgbinaryUnserialize()
{
if (\PHP_VERSION_ID === 70400) {
$this->markTestSkipped('igbinary is not compatible with PHP 7.4.0.');
}

$marshaller = new DefaultMarshaller();
$this->assertNull($marshaller->unmarshall(igbinary_serialize(null)));
$this->assertFalse($marshaller->unmarshall(igbinary_serialize(false)));
@@ -63,6 +67,10 @@ public function testNativeUnserializeNotFoundClass()
*/
public function testIgbinaryUnserializeNotFoundClass()
{
if (\PHP_VERSION_ID === 70400) {
$this->markTestSkipped('igbinary is not compatible with PHP 7.4.0.');
}

$this->expectException('DomainException');
$this->expectExceptionMessage('Class not found: NotExistingClass');
$marshaller = new DefaultMarshaller();
@@ -87,6 +95,10 @@ public function testNativeUnserializeInvalid()
*/
public function testIgbinaryUnserializeInvalid()
{
if (\PHP_VERSION_ID === 70400) {
$this->markTestSkipped('igbinary is not compatible with PHP 7.4.0');
}

$this->expectException('DomainException');
$this->expectExceptionMessage('igbinary_unserialize_zval: unknown type \'61\', position 5');
$marshaller = new DefaultMarshaller();

0 comments on commit 2c0c131

Please sign in to comment.
You can’t perform that action at this time.