Bug #78749 [Fbk->Opn]: Wrong error message when maxOccurs is exceeded
| From: | tony at marston-home dot demon dot co dot uk | Date: | Fri, 25 Oct 2019 17:11:24 +0000 |
| Subject: | Bug #78749 [Fbk->Opn]: Wrong error message when maxOccurs is exceeded | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-223464@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78749&edit=1
ID: 78749
User updated by: tony at marston-home dot demon dot co dot uk
Reported by: tony at marston-home dot demon dot co dot uk
Summary: Wrong error message when maxOccurs is exceeded
-Status: Feedback
+Status: Open
Type: Bug
Package: SOAP related
Operating System: Windows 10
PHP Version: 7.3.11
Block user comment: N
Private report: N
New Comment:
I have created a zip file containing the two files necessary to reproduce this fault as it simply
cannot be done in 20 lines of code or less. The WSDL file alone requires over 80 lines. This zip
file is available at:
https://www.tonymarston.net/php-mysql/gmx_soap_bug_report.zip
The 'contact' element in the WSDL file has a 'maxOccurs' attribute which I am
testing by sending 3 occurrences. If I set 'maxOccurs' to 1 it fails with
"SOAP-ERROR: Encoding object has no 'first_name' property" even though the array
does contain a value.
If I set 'maxOccurs' to 2 it does not fail (which it should as I have violated the
maximum) and it also sends all 3 occurrences to the server.
Previous Comments:
------------------------------------------------------------------------
[2019-10-24 19:43:07] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
I may be misreading the source, but it looks like you're triggering a code path that only
occurs when there is no value available.
------------------------------------------------------------------------
[2019-10-24 18:29:46] tony at marston-home dot demon dot co dot uk
Description:
------------
In my WSDL I have a complexType entry which has a maxOccurs set to 1. If I exceed this limit the
error message says "SOAP-ERROR: Encoding object has no 'first_name' property"
where 'first_name' is the first required field in the enclosed structure.
Test script:
---------------
WSDL:
<xsd:complexType name="ArrayOfContactInfo">
<xsd:sequence>
<xsd:element name="contact" type="tns:contact" minOccurs="0"
maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="contact">
<xsd:all>
<xsd:element name="title" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
<xsd:element name="first_name" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="middle_name" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
<xsd:element name="last_name" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
</xsd:all>
</xsd:complexType>
Expected result:
----------------
I expect a more meaningful error message such as "More than N occurrences exceeded"
Actual result:
--------------
The error message is totally misleading.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78749&edit=1