php / php/php-src

ext-soap + unbounded elements + classmap + 1 element

Đang mở
#11,705 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Bug Extension: soap Status: Needs Triage
Ngôn ngữ chính
C
Star
40.4k
Fork
8.2k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
96

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện lỗi bằng WSDL, PHP classmap, định nghĩa ResLFAType được cung cấp và một response chứa chính xác một phần tử resLFAsucces. Theo dõi đường dẫn giải tuần tự hóa của ext-soap đối với các phần tử unbounded và so sánh cách xử lý singleton với nhiều phần tử. Hoàn tất khi một response duy nhất điền vào mảng đã định kiểu mà không gặp assignment exception, đồng thời có regression test bao phủ trường hợp này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
php
Lĩnh vực
api
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.