Skip to content

Commit be90483

Browse files
committed
Merge branch '7.1' into 7.2
* 7.1: do not modify a constraint during validation to not leak its context remove entry about undeprecated getTypes() method not registered definitions must not be modified fix low deps [String] Fix Inflector for 'hardware' [Mime] Use streams instead of loading raw message generator into memory Bump Symfony version to 7.0.9 Update VERSION for 7.0.8 Update CHANGELOG for 7.0.8 Bump Symfony version to 6.4.9 Update VERSION for 6.4.8 Update CHANGELOG for 6.4.8 Bump Symfony version to 5.4.41 Update VERSION for 5.4.40 Update CONTRIBUTORS for 5.4.40 Update CHANGELOG for 5.4.40
2 parents a8ae4dd + 21027ea commit be90483

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

RawMessage.php

+26-3
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,31 @@ class RawMessage
2020
{
2121
private bool $isGeneratorClosed;
2222

23+
/**
24+
* @param iterable|string|resource $message
25+
*/
2326
public function __construct(
24-
private iterable|string $message,
27+
private $message,
2528
) {
2629
}
2730

31+
public function __destruct()
32+
{
33+
if (\is_resource($this->message)) {
34+
fclose($this->message);
35+
}
36+
}
37+
2838
public function toString(): string
2939
{
3040
if (\is_string($this->message)) {
3141
return $this->message;
3242
}
3343

44+
if (\is_resource($this->message)) {
45+
return stream_get_contents($this->message, -1, 0);
46+
}
47+
3448
$message = '';
3549
foreach ($this->message as $chunk) {
3650
$message .= $chunk;
@@ -51,10 +65,19 @@ public function toIterable(): iterable
5165
return;
5266
}
5367

68+
if (\is_resource($this->message)) {
69+
rewind($this->message);
70+
while ($line = fgets($this->message)) {
71+
yield $line;
72+
}
73+
74+
return;
75+
}
76+
5477
if ($this->message instanceof \Generator) {
55-
$message = '';
78+
$message = fopen('php://temp', 'w+');
5679
foreach ($this->message as $chunk) {
57-
$message .= $chunk;
80+
fwrite($message, $chunk);
5881
yield $chunk;
5982
}
6083
$this->isGeneratorClosed = !$this->message->valid();

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
"symfony/process": "^6.4|^7.0",
2929
"symfony/property-access": "^6.4|^7.0",
3030
"symfony/property-info": "^6.4|^7.0",
31-
"symfony/serializer": "^6.4|^7.0"
31+
"symfony/serializer": "^6.4.3|^7.0.3"
3232
},
3333
"conflict": {
3434
"egulias/email-validator": "~3.0.0",
3535
"phpdocumentor/reflection-docblock": "<3.2.2",
3636
"phpdocumentor/type-resolver": "<1.4.0",
3737
"symfony/mailer": "<6.4",
38-
"symfony/serializer": "<6.4"
38+
"symfony/serializer": "<6.4.3|>7.0,<7.0.3"
3939
},
4040
"autoload": {
4141
"psr-4": { "Symfony\\Component\\Mime\\": "" },

0 commit comments

Comments
 (0)