Skip to content

Commit

Permalink
fixed error on null value
Browse files Browse the repository at this point in the history
  • Loading branch information
ashenwolf committed Jul 26, 2019
1 parent a679372 commit 18394f1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ArrayToXmlFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ private function convertElement($value, $siblingKey = null)
{
$sequential = $this->isArrayAllKeySequential($value);

if (! is_array($value)) {
if (!is_array($value)) {
$value = $value;

$value = $this->removeControlCharacters($value);
if (!is_null($value)) {
$value = $this->removeControlCharacters($value);

$this->writer->text($value);
$this->writer->text($value);
}

return;
}
Expand Down Expand Up @@ -240,7 +242,7 @@ protected function startElement($name)
try {
$result = $this->writer->startElement($name);
} catch (exception $e) {
throw new DOMException($e->getMessage());
throw new DOMException("'{$name}': {$e->getMessage()}");
}
if (!$result)
throw new DOMException(error_get_last());
Expand Down

0 comments on commit 18394f1

Please sign in to comment.