diff --git a/S3.php b/S3.php index 0d9cfd19..0bd42a6b 100644 --- a/S3.php +++ b/S3.php @@ -1776,10 +1776,13 @@ private static function __getCloudFrontDistributionConfigXML($bucket, $enabled, if ($comment !== '') $distributionConfig->appendChild($dom->createElement('Comment', $comment)); $distributionConfig->appendChild($dom->createElement('Enabled', $enabled ? 'true' : 'false')); - $trusted = $dom->createElement('TrustedSigners'); - foreach ($trustedSigners as $id => $type) - $trusted->appendChild($id !== '' ? $dom->createElement($type, $id) : $dom->createElement($type)); - $distributionConfig->appendChild($trusted); + if (!empty($trustedSigners)) + { + $trusted = $dom->createElement('TrustedSigners'); + foreach ($trustedSigners as $id => $type) + $trusted->appendChild($id !== '' ? $dom->createElement($type, $id) : $dom->createElement($type)); + $distributionConfig->appendChild($trusted); + } $dom->appendChild($distributionConfig); //var_dump($dom->saveXML());