php / php/php-src

ext-soap + unbounded elements + classmap + 1 element

オープン
#11,705 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Extension: soap Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

提供された WSDL、PHP classmap、ResLFAType 定義、および resLFAsucces 要素をちょうど 1 つ含むレスポンスを使って失敗を再現します。unbounded 要素に対する ext-soap のデシリアライズ経路を追跡し、singleton の処理を複数要素の場合と比較します。1 つのレスポンスで代入例外を発生させずに型付き配列が設定され、このケースをカバーする回帰テストがあれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
api
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。