Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- SoapFault class: Invalid Fault code warning given? Can't be an empty string, an a..

Decoded Output download

--TEST--
SoapFault class: Invalid Fault code warning given? Can't be an empty string, an array of not 2 elements etc.
--EXTENSIONS--
soap
--FILE--
<?php

try {
    new SoapFault("", "message"); // Can't be an empty string
} catch (ValueError $exception) {
    echo $exception->getMessage() . "
";
}

try {
    new SoapFault(new stdClass(), "message");  // Can't be a non-string (except for null)
} catch (TypeError $exception) {
    echo $exception->getMessage() . "
";
}

$fault = new SoapFault("Sender", "message");
echo get_class($fault) . "
";
$fault = new SoapFault(null, "message");
echo get_class($fault) . "
";

try {
    new SoapFault(["more"], "message");  // two elements in array required
} catch (ValueError $exception) {
    echo $exception->getMessage() . "
";
}

try {
    new SoapFault(["m", "more", "superfluous"], "message"); // two required
} catch (ValueError $exception) {
    echo $exception->getMessage() . "
";
}

$fault = new SoapFault(["more-ns", "Sender"], "message");  // two given
echo get_class($fault);

?>
--EXPECT--
SoapFault::__construct(): Argument #1 ($code) is not a valid fault code
SoapFault::__construct(): Argument #1 ($code) must be of type array|string|null, stdClass given
SoapFault
SoapFault
SoapFault::__construct(): Argument #1 ($code) is not a valid fault code
SoapFault::__construct(): Argument #1 ($code) is not a valid fault code
SoapFault

Did this file decode correctly?

Original Code

--TEST--
SoapFault class: Invalid Fault code warning given? Can't be an empty string, an array of not 2 elements etc.
--EXTENSIONS--
soap
--FILE--
<?php

try {
    new SoapFault("", "message"); // Can't be an empty string
} catch (ValueError $exception) {
    echo $exception->getMessage() . "\n";
}

try {
    new SoapFault(new stdClass(), "message");  // Can't be a non-string (except for null)
} catch (TypeError $exception) {
    echo $exception->getMessage() . "\n";
}

$fault = new SoapFault("Sender", "message");
echo get_class($fault) . "\n";
$fault = new SoapFault(null, "message");
echo get_class($fault) . "\n";

try {
    new SoapFault(["more"], "message");  // two elements in array required
} catch (ValueError $exception) {
    echo $exception->getMessage() . "\n";
}

try {
    new SoapFault(["m", "more", "superfluous"], "message"); // two required
} catch (ValueError $exception) {
    echo $exception->getMessage() . "\n";
}

$fault = new SoapFault(["more-ns", "Sender"], "message");  // two given
echo get_class($fault);

?>
--EXPECT--
SoapFault::__construct(): Argument #1 ($code) is not a valid fault code
SoapFault::__construct(): Argument #1 ($code) must be of type array|string|null, stdClass given
SoapFault
SoapFault
SoapFault::__construct(): Argument #1 ($code) is not a valid fault code
SoapFault::__construct(): Argument #1 ($code) is not a valid fault code
SoapFault

Function Calls

None

Variables

None

Stats

MD5 99b9ce401ee4bca3445bddc1c773f374
Eval Count 0
Decode Time 84 ms