Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with non-sequential array keys.
Xml::fromArray() should not cause errors with non-sequential numeric array keys. Fixes #2580
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,7 +230,7 @@ protected static function _fromArray($dom, $node, &$data, $format) { | |
if ($key[0] === '@') { | ||
throw new XmlException(__d('cake_dev', 'Invalid array')); | ||
} | ||
if (array_keys($value) === range(0, count($value) - 1)) { // List | ||
if (is_numeric(implode(array_keys($value), ''))) { // List | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
markstory
Author
Member
|
||
foreach ($value as $item) { | ||
$itemData = compact('dom', 'node', 'key', 'format'); | ||
$itemData['value'] = $item; | ||
|
isnt the first argument the glue and the second the array for implode()?