bug #34419 [Cache] Disable igbinary on PHP >= 7.4 (nicolas-grekas)
This PR was merged into the 4.3 branch.
Discussion
----------
[Cache] Disable igbinary on PHP >= 7.4
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Until https://github.com/igbinary/igbinary/issues/244 is fixed.
Commits
-------
a2c924d772
[Cache] Disable igbinary on PHP >= 7.4
This commit is contained in:
commit
479efc54f3
@ -25,9 +25,9 @@ class DefaultMarshaller implements MarshallerInterface
|
|||||||
public function __construct(bool $useIgbinarySerialize = null)
|
public function __construct(bool $useIgbinarySerialize = null)
|
||||||
{
|
{
|
||||||
if (null === $useIgbinarySerialize) {
|
if (null === $useIgbinarySerialize) {
|
||||||
$useIgbinarySerialize = \extension_loaded('igbinary') && \PHP_VERSION_ID !== 70400;
|
$useIgbinarySerialize = \extension_loaded('igbinary') && \PHP_VERSION_ID < 70400;
|
||||||
} elseif ($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.'));
|
throw new CacheException('The "igbinary" PHP extension is not '.(\PHP_VERSION_ID >= 70400 ? 'compatible with PHP 7.4.' : 'loaded.'));
|
||||||
}
|
}
|
||||||
$this->useIgbinarySerialize = $useIgbinarySerialize;
|
$this->useIgbinarySerialize = $useIgbinarySerialize;
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ class DefaultMarshaller implements MarshallerInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
static $igbinaryNull;
|
static $igbinaryNull;
|
||||||
if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') && \PHP_VERSION_ID !== 70400 ? igbinary_serialize(null) : false)) {
|
if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') && \PHP_VERSION_ID < 70400 ? igbinary_serialize(null) : false)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
|
$unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
|
||||||
|
@ -24,7 +24,7 @@ class DefaultMarshallerTest extends TestCase
|
|||||||
'b' => function () {},
|
'b' => function () {},
|
||||||
];
|
];
|
||||||
|
|
||||||
$expected = ['a' => \extension_loaded('igbinary') && \PHP_VERSION_ID !== 70400 ? 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($expected, $marshaller->marshall($values, $failed));
|
||||||
$this->assertSame(['b'], $failed);
|
$this->assertSame(['b'], $failed);
|
||||||
}
|
}
|
||||||
@ -43,8 +43,8 @@ class DefaultMarshallerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testIgbinaryUnserialize()
|
public function testIgbinaryUnserialize()
|
||||||
{
|
{
|
||||||
if (\PHP_VERSION_ID === 70400) {
|
if (\PHP_VERSION_ID >= 70400) {
|
||||||
$this->markTestSkipped('igbinary is not compatible with PHP 7.4.0.');
|
$this->markTestSkipped('igbinary is not compatible with PHP 7.4.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$marshaller = new DefaultMarshaller();
|
$marshaller = new DefaultMarshaller();
|
||||||
@ -67,8 +67,8 @@ class DefaultMarshallerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testIgbinaryUnserializeNotFoundClass()
|
public function testIgbinaryUnserializeNotFoundClass()
|
||||||
{
|
{
|
||||||
if (\PHP_VERSION_ID === 70400) {
|
if (\PHP_VERSION_ID >= 70400) {
|
||||||
$this->markTestSkipped('igbinary is not compatible with PHP 7.4.0.');
|
$this->markTestSkipped('igbinary is not compatible with PHP 7.4.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->expectException('DomainException');
|
$this->expectException('DomainException');
|
||||||
@ -95,8 +95,8 @@ class DefaultMarshallerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testIgbinaryUnserializeInvalid()
|
public function testIgbinaryUnserializeInvalid()
|
||||||
{
|
{
|
||||||
if (\PHP_VERSION_ID === 70400) {
|
if (\PHP_VERSION_ID >= 70400) {
|
||||||
$this->markTestSkipped('igbinary is not compatible with PHP 7.4.0');
|
$this->markTestSkipped('igbinary is not compatible with PHP 7.4.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->expectException('DomainException');
|
$this->expectException('DomainException');
|
||||||
|
Reference in New Issue
Block a user