[php-src] Issue #8578: SOAP: Error thrown on wrong parameter
| From: | robertnisipeanu | Date: | Wed, 18 May 2022 18:50:50 +0000 |
| Subject: | [php-src] Issue #8578: SOAP: Error thrown on wrong parameter | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241536@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8578
Author: robertnisipeanu
### Description
The following code:
```php
<?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
```
2803c8fb8dafea651e13bb28da753cbbf7458792 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).
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_