Skip to content

Commit ddff21f

Browse files
Merge branch '7.4' into 8.0
* 7.4: [Serializer] Fix mixed-typed constructor parameters overriding getter-inferred type Fix tests [Cache] Ensure compatibility with Relay extension 0.21.0 [Mime][TwigBridge] Fix merge conflict resolution [Ldap] Make the Adapter resettable [Serializer] Remove needless line in changelog [MonologBridge] Fix ConsoleHandler losing output after nested command terminates [Cache] Fix tests [EventDispatcher] Fix memory leak in TraceableEventDispatcher for long-running processes [TwigBridge][Mime] Add missing tests [TwigBridge] Refactor image method to use DataPart content ID [Cache] Fix undefined property access [Console] Fix performance regression in OutputFormatter for ASCII content [Serializer] Fix can*() prefix support in GetSetMethodNormalizer [Cache] Fix Psr16Cache::getMultiple() returning ValueWrapper with TagAwareAdapter Configure deprecation triggers
2 parents 5d26d19 + 6df02f9 commit ddff21f

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

Part/DataPart.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ public function __serialize(): array
137137
'_parent' => $parent,
138138
'filename' => $this->filename,
139139
'mediaType' => $this->mediaType,
140+
'cid' => $this->cid,
140141
];
141142
}
142143

@@ -145,5 +146,6 @@ public function __unserialize(array $data): void
145146
parent::__unserialize(['_headers' => $data['_headers'] ?? $data["\0*\0_headers"], ...$data['_parent'] ?? $data["\0*\0_parent"]]);
146147
$this->filename = $data['filename'] ?? $data["\0".self::class."\0filename"] ?? null;
147148
$this->mediaType = $data['mediaType'] ?? $data["\0".self::class."\0mediaType"];
149+
$this->cid = $data['cid'] ?? $data["\0".self::class."\0cid"] ?? null;
148150
}
149151
}

Tests/Part/DataPartTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,16 @@ public function testSerialize()
222222
$expected = clone $p;
223223
$this->assertEquals($expected->toString(), unserialize(serialize($p))->toString());
224224
}
225+
226+
public function testSerializePreservesContentId()
227+
{
228+
$p = new DataPart('content', 'image.jpg', 'image/jpeg');
229+
$p->asInline();
230+
$cid = $p->getContentId();
231+
232+
$unserialized = unserialize(serialize($p));
233+
234+
$this->assertTrue($unserialized->hasContentId());
235+
$this->assertSame($cid, $unserialized->getContentId());
236+
}
225237
}

phpunit.xml.dist

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="vendor/autoload.php"
@@ -20,6 +20,11 @@
2020
</testsuites>
2121

2222
<source ignoreSuppressionOfDeprecations="true">
23+
<deprecationTrigger>
24+
<function>trigger_deprecation</function>
25+
<method>Doctrine\Deprecations\Deprecation::trigger</method>
26+
<method>Doctrine\Deprecations\Deprecation::triggerIfCalledFromOutside</method>
27+
</deprecationTrigger>
2328
<include>
2429
<directory>./</directory>
2530
</include>

0 commit comments

Comments
 (0)