HEX
Server: Apache
System: Linux andromeda.lojoweb.com 4.18.0-372.26.1.el8_6.x86_64 #1 SMP Tue Sep 13 06:07:14 EDT 2022 x86_64
User: nakedfoamlojoweb (1056)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/share/doc/cpanel-php84-xml-serializer/examples/Serializer_Bug7112.php
<?php
require_once 'XML/Serializer.php';

$citation =  array('book' =>
                array(
                    'author' => array(
                         array('John Doe', 'attributes' => array('id' => 1)),
                         array('Bob Jones', 'attributes' =>array('id' => 2))
                    ),
                    'title' => 'Title of the book'
                  )
               );

$s = new XML_Serializer();
$s->setOption(XML_SERIALIZER_OPTION_INDENT, '    ');
$s->setOption(XML_SERIALIZER_OPTION_ATTRIBUTES_KEY, 'attributes');
$s->setOption(XML_SERIALIZER_OPTION_MODE, XML_SERIALIZER_MODE_SIMPLEXML);
$s->serialize($citation);

echo '<pre>';
echo htmlentities($s->getSerializedData());
echo '</pre>';
?>