From 435bcf44c6175613ff39b5d74df393ff8a632a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Tue, 11 Jul 2023 17:02:31 +0200 Subject: [PATCH] [VarDumper] Add tests to demonstrate a bug when dumping ArrayObject with full stack fmk --- .../Integration/dump_data_collector.phpt | 43 +++++++++++++++++++ .../Integration/dump_data_collector2.phpt | 43 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 src/Symfony/Component/VarDumper/Tests/Integration/dump_data_collector.phpt create mode 100644 src/Symfony/Component/VarDumper/Tests/Integration/dump_data_collector2.phpt diff --git a/src/Symfony/Component/VarDumper/Tests/Integration/dump_data_collector.phpt b/src/Symfony/Component/VarDumper/Tests/Integration/dump_data_collector.phpt new file mode 100644 index 0000000000000..352fe1f42ed82 --- /dev/null +++ b/src/Symfony/Component/VarDumper/Tests/Integration/dump_data_collector.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test integration with Symfony's DumpDataCollector +--FILE-- +cloneVar($var); + if (null !== $label) { + $var = $var->withContext(['label' => $label]); + } + + $dumper->dump($var); + }; + VarDumper::setHandler($handler); + $handler($var, $label); +}); + +$schemas = new \ArrayObject(); +dump($schemas); +$schemas['X'] = new \ArrayObject(['type' => 'object']); + +--EXPECTF-- +ArrayObject {#%d + -storage: [] + flag::STD_PROP_LIST: false + flag::ARRAY_AS_PROPS: false + iteratorClass: "ArrayIterator" +} diff --git a/src/Symfony/Component/VarDumper/Tests/Integration/dump_data_collector2.phpt b/src/Symfony/Component/VarDumper/Tests/Integration/dump_data_collector2.phpt new file mode 100644 index 0000000000000..36a5030110362 --- /dev/null +++ b/src/Symfony/Component/VarDumper/Tests/Integration/dump_data_collector2.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test integration with Symfony's DumpDataCollector +--FILE-- +cloneVar($var); + if (null !== $label) { + $var = $var->withContext(['label' => $label]); + } + + $dumper->dump($var); + }; + VarDumper::setHandler($handler); + $handler($var, $label); +}); + +$schemas = new \ArrayObject(); +dump($schemas); +$schemas['X'] = 'A'; + +--EXPECTF-- +ArrayObject {#%d + -storage: [] + flag::STD_PROP_LIST: false + flag::ARRAY_AS_PROPS: false + iteratorClass: "ArrayIterator" +}