ext-soap + unbounded elements + classmap + 1 element
未关闭
还没有人认领这个 Issue。
Bug
Extension: soap
Status: Needs Triage
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 15 小时
- 30 天内合并 PR
- 103
描述
Description
The WSDL for this class:
<xsd:complexType name="resLFAType">
<xsd:sequence>
<xsd:element name="resInfo" type="tns:resInfoType"></xsd:element>
<xsd:element name="resLFAsucces" type="tns:LFAsuccesType" minOccurs="0" maxOccurs="unbounded"></xsd:element>
<xsd:element name="resLFAerror" type="tns:LFAerrorType" minOccurs="0" maxOccurs="unbounded"></xsd:element>
</xsd:sequence>
</xsd:complexType>
while using this SOAP classmap:
protected static array $classMap = [
'resInfoType' => ResInfoType::class,
'resLFAType' => ResLFAType::class,
'LFAsuccesType' => LFASuccessType::class,
'LFAerrorType' => LFAErrorType::class,
];
while having this for ResLFAType:
<?php
class ResLFAType
{
public ?ResInfoType $resInfo;
/**
* @var LFASuccessType[]
*/
public array $resLFAsucces = [];
/**
* @var LFAErrorType[]
*/
public array $resLFAerror = [];
}
When the SOAP service is responding with multiple resLFAsucces and/or resLFAerror, everything works fine
BUT when the SOAP service is responding with exactly one of resLFAsucces, then i get this Exception:
Cannot assign LFASuccessType to property ResLFAType::$resLFAsucces of type array
it seems to understand when getting multiple entries to assign them correctly to the property,
but it fails when only getting one object.
PHP Version
PHP 8.2.6
Operating System
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用提供的 WSDL、PHP classmap、ResLFAType 定义以及包含恰好一个 resLFAsucces 元素的响应重现该失败。跟踪 ext-soap 对 unbounded 元素的反序列化路径,并比较 singleton 与多个元素时的处理方式。完成标准是:单个响应能够填充类型化数组而不会出现赋值异常,并且有一个回归测试覆盖此情况。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- api
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100