Skip to content

SOAP: Error thrown on wrong parameter #8578

Closed

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

Activity

  1. cmb69 commented on May 19, 2022

    @cmb69
    Member

    Ah, good catch. Thank you!

    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?

    It seems to me that has been inadvertently changed. Prior to PHP 8.0.0, the only requirement was that the actor string is not empty. Maybe @kocsismate remembers if there was a reason to change that? On the other hand, the actor is supposed to be an URI, so even an artificial requirement of more than two characters shouldn't be a problem.

  2. self-assigned this
    on May 19, 2022
  3. added 2 commits that reference this issue on May 19, 2022
    8735ae9
    dd89aca
  4. added a commit that references this issue on May 19, 2022
    14319c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions