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-- stream_context_set_option() error conditions --FILE-- <?php $ctx = stream_contex..

Decoded Output download

--TEST--
stream_context_set_option() error conditions
--FILE--
<?php

$ctx = stream_context_create();
try {
    stream_context_set_option($ctx, [], "x");
} catch (Error $e) {
    echo $e->getMessage(), "
";
}
try {
    stream_context_set_option($ctx, [], null, "x");
} catch (Error $e) {
    echo $e->getMessage(), "
";
}
try {
    stream_context_set_option($ctx, "x");
} catch (Error $e) {
    echo $e->getMessage(), "
";
}
try {
    stream_context_set_option($ctx, "x", "y");
} catch (Error $e) {
    echo $e->getMessage(), "
";
}

?>
--EXPECT--
stream_context_set_option(): Argument #3 ($option_name) must be null when argument #2 ($wrapper_or_options) is an array
stream_context_set_option(): Argument #4 ($value) cannot be provided when argument #2 ($wrapper_or_options) is an array
stream_context_set_option(): Argument #3 ($option_name) cannot be null when argument #2 ($wrapper_or_options) is a string
stream_context_set_option(): Argument #4 ($value) must be provided when argument #2 ($wrapper_or_options) is a string

Did this file decode correctly?

Original Code

--TEST--
stream_context_set_option() error conditions
--FILE--
<?php

$ctx = stream_context_create();
try {
    stream_context_set_option($ctx, [], "x");
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
try {
    stream_context_set_option($ctx, [], null, "x");
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
try {
    stream_context_set_option($ctx, "x");
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}
try {
    stream_context_set_option($ctx, "x", "y");
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}

?>
--EXPECT--
stream_context_set_option(): Argument #3 ($option_name) must be null when argument #2 ($wrapper_or_options) is an array
stream_context_set_option(): Argument #4 ($value) cannot be provided when argument #2 ($wrapper_or_options) is an array
stream_context_set_option(): Argument #3 ($option_name) cannot be null when argument #2 ($wrapper_or_options) is a string
stream_context_set_option(): Argument #4 ($value) must be provided when argument #2 ($wrapper_or_options) is a string

Function Calls

None

Variables

None

Stats

MD5 a29b3ccf06d9d8b587b7b6d1c70e88c7
Eval Count 0
Decode Time 78 ms