7

I'm getting this error in php7.2. I'm using symfony4.

Warning: Use of undefined constant XML_PI_NODE - assumed 'XML_PI_NODE' (this will throw an Error in a future version of PHP)

This is the error line.

in var/cache/dev/ContainerIZRQnYa/getSerializerService.php (line 55)
return $this->services['serializer'] = new \Symfony\Component\Serializer\Serializer([0 => new \Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer(), 1 => new \Symfony\Component\Serializer\Normalizer\DateTimeNormalizer(), 2 => new \Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer(), 3 => new \Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer(), 4 => new \Symfony\Component\Serializer\Normalizer\DataUriNormalizer(), 5 => new \Symfony\Component\Serializer\Normalizer\ArrayDenormalizer(), 6 => new \Symfony\Component\Serializer\Normalizer\ObjectNormalizer($a, new \Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter($a), new \Symfony\Component\PropertyAccess\PropertyAccessor(false, false, new \Symfony\Component\Cache\Adapter\ArrayAdapter(0, false)), NULL, new \Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata($a))], [0 => new \Symfony\Component\Serializer\Encoder\XmlEncoder(), 1 => new \Symfony\Component\Serializer\Encoder\JsonEncoder(), 2 => new \Symfony\Component\Serializer\Encoder\YamlEncoder(), 3 => new \Symfony\Component\Serializer\Encoder\CsvEncoder()]);

I already cleared cache and all permission has setted before. What should i do?

3

1 Answer 1

10

I had the same problem, I'd installed PHP XML using

sudo apt install php7.4-xml

but was still getting it. It went away after I ran:

install zlib1g-dev libxml2-dev

2
  • sudo apt install php-xml was enough for my php8.1.2 installation under ubuntu jammy (22.04), thanks
    – bcag2
    Jun 13, 2022 at 12:54
  • 2
    sudo apt install phpX.X-xml Should be enough, don't need to install zlib1g. If it's not fixed try sudo a2dismod phpX.X sudo systemctl restart apache2 sudo a2enmod php X.X sudo systemctl restart apache2 Dec 14, 2022 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.