Skip to content

SOAP: Error thrown on wrong parameter #8578

Closed
@robertnisipeanu

Description

@robertnisipeanu

Description

The following code:

<?php
new \SoapHeader("ns", "name", [], false, "AB");

Resulted in this output:

Fatal error: Uncaught ValueError: SoapHeader::__construct(): Argument #2 ($name) must be longer than 2 characters in /home/user/scripts/code.php:4

But I expected this output instead:

Fatal error: Uncaught ValueError: SoapHeader::__construct(): Argument #5 ($actor) must be longer than 2 characters in /home/user/scripts/code.php:4

2803c8f added a check in file ext/soap/soap.c on the SoapHeader constructor which checks that the length of actor is greater than 2 when it is a string. However, the error is thrown on parameter 2 ($name) instead of being thrown on parameter 5 ($actor):

zend_argument_value_error(2, "must be longer than 2 characters");

Besides the error being thrown on the wrong parameter number, is there a specific reason of adding a minimum length of 2 on the actor string?

PHP Version

PHP 8.0

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions