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-- xml_parser_free - Test setting skip whitespace and invalid encoding type --CREDIT..

Decoded Output download

--TEST--
xml_parser_free - Test setting skip whitespace and invalid encoding type
--CREDITS--
Mark Niebergall <[email protected]>
PHP TestFest 2017 - UPHPU
--EXTENSIONS--
xml
--FILE--
<?php

$xmlParser = xml_parser_create();

var_dump(xml_parser_set_option($xmlParser, XML_OPTION_SKIP_WHITE, 1));

try {
    xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, 'Invalid Encoding');
} catch (ValueError $exception) {
    echo $exception->getMessage() . "
";
}

?>
--EXPECT--
bool(true)
xml_parser_set_option(): Argument #3 ($value) is not a supported target encoding

Did this file decode correctly?

Original Code

--TEST--
xml_parser_free - Test setting skip whitespace and invalid encoding type
--CREDITS--
Mark Niebergall <[email protected]>
PHP TestFest 2017 - UPHPU
--EXTENSIONS--
xml
--FILE--
<?php

$xmlParser = xml_parser_create();

var_dump(xml_parser_set_option($xmlParser, XML_OPTION_SKIP_WHITE, 1));

try {
    xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, 'Invalid Encoding');
} catch (ValueError $exception) {
    echo $exception->getMessage() . "\n";
}

?>
--EXPECT--
bool(true)
xml_parser_set_option(): Argument #3 ($value) is not a supported target encoding

Function Calls

xml_parser_create 1

Variables

None

Stats

MD5 59eae5197cd130d76203e66ea8aa2aea
Eval Count 0
Decode Time 87 ms