mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 00:48:25 +00:00
Fix a bug in Xml::fromArray()
When creating from an array with elements like this: `[ "a" => [ 0 ] ]` or `[ "a" => [ '0' ] ]` it fails and produces XML like this `<a/>` instant of `<a>0</a>`. The problem is that in PHP `empty('0')` is true, so an exception to this case is needed.
This commit is contained in:
parent
cdef76eeda
commit
4d77cb059d
1 changed files with 1 additions and 1 deletions
|
@ -312,7 +312,7 @@ class Xml {
|
|||
$childNS = $value['xmlns:'];
|
||||
unset($value['xmlns:']);
|
||||
}
|
||||
} elseif (!empty($value) || $value === 0) {
|
||||
} elseif (!empty($value) || $value === 0 || $value === '0') {
|
||||
$childValue = (string)$value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue