8000 bug #33652 [Cache] skip igbinary on PHP 7.4.0 (nicolas-grekas) · symfony/symfony@3909575 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3909575

Browse files
bug #33652 [Cache] skip igbinary on PHP 7.4.0 (nicolas-grekas)
This PR was merged into the 4.3 branch. Discussion ---------- [Cache] skip igbinary on PHP 7.4.0 | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Our CI currently fails because of that. I'm blacklisting 7.4.0 exactly so that we don't have to maintain these lines, betting on the issue being resolved before 7.4.1 is released. See igbinary/igbinary#237 Commits ------- 2c0c131 [Cache] skip igbinary on PHP 7.4.0
2 parents b4e2ba2 + 2c0c131 commit 3909575

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/Symfony/Component/Cache/Marshaller/DefaultMarshaller.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class DefaultMarshaller implements MarshallerInterface
2525
public function __construct(bool $useIgbinarySerialize = null)
2626
{
2727
if (null === $useIgbinarySerialize) {
28-
$useIgbinarySerialize = \extension_loaded('igbinary');
29-
} elseif ($useIgbinarySerialize && !\extension_loaded('igbinary')) {
30-
throw new CacheException('The "igbinary" PHP extension is not loaded.');
28+
$useIgbinarySerialize = \extension_loaded('igbinary') && \PHP_VERSION_ID !== 70400;
29+
} elseif ($useIgbinarySerialize && (!\extension_loaded('igbinary') || \PHP_VERSION_ID === 70400)) {
30+
throw new CacheException('The "igbinary" PHP extension is not '.(\PHP_VERSION_ID === 70400 ? 'compatible with PHP 7.4.0.' : 'loaded.'));
3131
}
3232
$this->useIgbinarySerialize = $useIgbinarySerialize;
3333
}
@@ -66,7 +66,7 @@ public function unmarshall(string $value)
6666
return null;
6767
}
6868
static $igbinaryNull;
69-
if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') ? igbinary_serialize(null) : false)) {
69+
if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') && \PHP_VERSION_ID !== 70400 ? igbinary_serialize(null) : false)) {
7070
return null;
7171
}
7272
$unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');

src/Symfony/Component/Cache/Tests/Marshaller/DefaultMarshallerTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testSerialize()
2424
'b' => function () {},
2525
];
2626

27-
$expected = ['a' => \extension_loaded('igbinary') ? igbinary_serialize(123) : serialize(123)];
27+
$expected = ['a' => \extension_loaded('igbinary') && \PHP_VERSION_ID !== 70400 ? igbinary_serialize(123) : serialize(123)];
2828
$this->assertSame($expected, $marshaller->marshall($values, $failed));
2929
$this->assertSame(['b'], $failed);
3030
}
@@ -43,6 +43,10 @@ public function testNativeUnserialize()
4343
*/
4444
public function testIgbinaryUnserialize()
4545
{
46+
if (\PHP_VERSION_ID === 70400) {
47+
$this->markTestSkipped('igbinary is not compatible with PHP 7.4.0.');
48+
}
49+
4650
$marshaller = new DefaultMarshaller();
4751
$this->assertNull($marshaller->unmarshall(igbinary_serialize(null)));
4852
$this->assertFalse($marshaller->unmarshall(igbinary_serialize(false)));
@@ -63,6 +67,10 @@ public function testNativeUnserializeNotFoundClass()
6367
*/
6468
public function testIgbinaryUnserializeNotFoundClass()
6569
{
70+
if (\PHP_VERSION_ID === 70400) {
71+
$this->markTestSkipped('igbinary is not compatible with PHP 7.4.0.');
72+
}
73+
6674
$this->expectException('DomainException');
6775
$this->expectExceptionMessage('Class not found: NotExistingClass');
6876
$marshaller = new DefaultMarshaller();
@@ -87,6 +95,10 @@ public function testNativeUnserializeInvalid()
8795
*/
8896
public function testIgbinaryUnserializeInvalid()
8997
{
98+
if (\PHP_VERSION_ID === 70400) {
99+
$this->markTestSkipped('igbinary is not compatible with PHP 7.4.0');
100+
}
101+
90102
$this->expectException('DomainException');
91103
$this->expectExceptionMessage('igbinary_unserialize_zval: unknown type \'61\', position 5');
92104
$marshaller = new DefaultMarshaller();

0 commit comments

Comments
 (0)
0