hyperf / hyperf/codec

SimpleXMLElement::addChild(): Argument #1 ($qualifiedName) must be of type string, int given

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Xml::toXml 39行 self::toXml($value, $xml->addChild($key)); 当传入的数据为列表时,该处没有处理key为数字的情况,如:参数为
[
'item' => [
[
'itemCode' => '5110093',
'itemId' => '10415'
],
[
'itemCode' => '5110092',
'itemId' => '10412'
],
]

]

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at Xml::toXml around line 39 and reproduce the failure with the nested list shown in the issue. Inspect how numeric keys reach SimpleXMLElement::addChild(); done means the example data can be converted to XML without the qualifiedName type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.