Skip to content

Commit 88ffc3c

Browse files
Merge branch '6.4' into 7.0
* 6.4: [FrameworkBundle] Add TemplateController to the list of allowed controllers for fragments [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] Remove wrong final tags [Serializer] Fix denormalize constructor arguments Add some more non-countable English nouns Add hint that changing input arguments has no effect register the virtual request stack together with common profiling services Don't lose checkpoint state when lock is acquired from another [DomCrawler] Revert "bug #52579 UriResolver support path with colons" [VarExporter] Fix handling mangled property names returned by __sleep() Update Github template for 7.1 Fix memory limit in PhpSubprocess unit test
2 parents a546e8d + ca57ddc commit 88ffc3c

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
@@ -158,21 +158,19 @@ public static function prepare($values, $objectsPool, &$refsPool, &$objectsCount
158158
$n = substr($n, 1 + $i);
159159
}
160160
if (null !== $sleep) {
161-
if (!isset($sleep[$n]) || ($i && $c !== $class)) {
161+
if (!isset($sleep[$name]) && (!isset($sleep[$n]) || ($i && $c !== $class))) {
162162
unset($arrayValue[$name]);
163163
continue;
164164
}
165-
$sleep[$n] = false;
165+
unset($sleep[$name], $sleep[$n]);
166166
}
167167
if (!\array_key_exists($name, $proto) || $proto[$name] !== $v || "\x00Error\x00trace" === $name || "\x00Exception\x00trace" === $name) {
168168
$properties[$c][$n] = $v;
169169
}
170170
}
171171
if ($sleep) {
172172
foreach ($sleep as $n => $v) {
173-
if (false !== $v) {
174-
trigger_error(sprintf('serialize(): "%s" returned as member variable from __sleep() but does not exist', $n), \E_USER_NOTICE);
175-
}
173+
trigger_error(sprintf('serialize(): "%s" returned as member variable from __sleep() but does not exist', $n), \E_USER_NOTICE);
176174
}
177175
}
178176
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
@@ -329,17 +329,21 @@ public function setFlags($flags): void
329329
class GoodNight
330330
{
331331
public $good;
332+
protected $foo;
333+
private $bar;
332334

333335
public function __construct()
334336
{
335337
unset($this->good);
338+
$this->foo = 'afternoon';
339+
$this->bar = 'morning';
336340
}
337341

338342
public function __sleep(): array
339343
{
340344
$this->good = 'night';
341345

342-
return ['good'];
346+
return ['good', 'foo', "\0*\0foo", "\0".__CLASS__."\0bar"];
343347
}
344348
}
345349

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)