Skip to content

Commit ca57ddc

Browse files
Merge branch '6.3' into 6.4
* 6.3: [Cache][Lock] Fix PDO store not creating table + add tests Closes #51936-Added Missing translations for Czech (cs) in validators.cs.xlf file Added missing translations in turkish and updated validators.tr.xlf [Serializer] Fix denormalizing date intervals having both weeks and days [Validator] updated Turkish translation [Serializer] Fix denormalize constructor arguments Add some more non-countable English nouns Add hint that changing input arguments has no effect [DomCrawler] Revert "bug #52579 UriResolver support path with colons" [VarExporter] Fix handling mangled property names returned by __sleep() Update Github template for 7.1
2 parents 2dfbb03 + faacfd3 commit ca57ddc

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

Internal/Exporter.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,21 +159,19 @@ public static function prepare($values, $objectsPool, &$refsPool, &$objectsCount
159159
$n = substr($n, 1 + $i);
160160
}
161161
if (null !== $sleep) {
162-
if (!isset($sleep[$n]) || ($i && $c !== $class)) {
162+
if (!isset($sleep[$name]) && (!isset($sleep[$n]) || ($i && $c !== $class))) {
163163
unset($arrayValue[$name]);
164164
continue;
165165
}
166-
$sleep[$n] = false;
166+
unset($sleep[$name], $sleep[$n]);
167167
}
168168
if (!\array_key_exists($name, $proto) || $proto[$name] !== $v || "\x00Error\x00trace" === $name || "\x00Exception\x00trace" === $name) {
169169
$properties[$c][$n] = $v;
170170
}
171171
}
172172
if ($sleep) {
173173
foreach ($sleep as $n => $v) {
174-
if (false !== $v) {
175-
trigger_error(sprintf('serialize(): "%s" returned as member variable from __sleep() but does not exist', $n), \E_USER_NOTICE);
176-
}
174+
trigger_error(sprintf('serialize(): "%s" returned as member variable from __sleep() but does not exist', $n), \E_USER_NOTICE);
177175
}
178176
}
179177
if (method_exists($class, '__unserialize')) {

Tests/Fixtures/var-on-sleep.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
'night',
1212
],
1313
],
14+
'Symfony\\Component\\VarExporter\\Tests\\GoodNight' => [
15+
'foo' => [
16+
'afternoon',
17+
],
18+
'bar' => [
19+
'morning',
20+
],
21+
],
1422
],
1523
$o[0],
1624
[]

Tests/VarExporterTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,17 +333,21 @@ public function setFlags($flags): void
333333
class GoodNight
334334
{
335335
public $good;
336+
protected $foo;
337+
private $bar;
336338

337339
public function __construct()
338340
{
339341
unset($this->good);
342+
$this->foo = 'afternoon';
343+
$this->bar = 'morning';
340344
}
341345

342346
public function __sleep(): array
343347
{
344348
$this->good = 'night';
345349

346-
return ['good'];
350+
return ['good', 'foo', "\0*\0foo", "\0".__CLASS__."\0bar"];
347351
}
348352
}
349353

VarExporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static function export(mixed $value, bool &$isStaticValue = null, array &
8282
ksort($states);
8383

8484
$wakeups = [null];
85-
foreach ($states as $k => $v) {
85+
foreach ($states as $v) {
8686
if (\is_array($v)) {
8787
$wakeups[-$v[0]] = $v[1];
8888
} else {

0 commit comments

Comments
 (0)