From 6cdcb1bb9436503451104bf0f45e216fabf45d36 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Fri, 3 Jun 2022 22:09:54 +0200 Subject: [PATCH] [Serializer] Fix ignore attribute in Xml files --- .../Component/Serializer/Mapping/Loader/XmlFileLoader.php | 2 +- .../Component/Serializer/Tests/Fixtures/serialization.xml | 1 + .../Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Serializer/Mapping/Loader/XmlFileLoader.php b/src/Symfony/Component/Serializer/Mapping/Loader/XmlFileLoader.php index d023402f74ade..5ef21fb370683 100644 --- a/src/Symfony/Component/Serializer/Mapping/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/Serializer/Mapping/Loader/XmlFileLoader.php @@ -72,7 +72,7 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata) } if (isset($attribute['ignore'])) { - $attributeMetadata->setIgnore((bool) $attribute['ignore']); + $attributeMetadata->setIgnore(XmlUtils::phpize($attribute['ignore'])); } foreach ($attribute->context as $node) { diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/serialization.xml b/src/Symfony/Component/Serializer/Tests/Fixtures/serialization.xml index da61e0acce8dc..69243cfddb5ae 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/serialization.xml +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/serialization.xml @@ -37,6 +37,7 @@ + diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php index 201cb68ba8ff8..47d6305a898f2 100644 --- a/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php @@ -107,6 +107,7 @@ public function testLoadIgnore() $attributesMetadata = $classMetadata->getAttributesMetadata(); $this->assertTrue($attributesMetadata['ignored1']->isIgnored()); $this->assertTrue($attributesMetadata['ignored2']->isIgnored()); + $this->assertFalse($attributesMetadata['notIgnored']->isIgnored()); } protected function getLoaderForContextMapping(): LoaderInterface pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy