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-- XMLReader: setSchema Error --EXTENSIONS-- xmlreader --FILE-- <?php $reader = new..

Decoded Output download

--TEST--
XMLReader: setSchema Error
--EXTENSIONS--
xmlreader
--FILE--
<?php

$reader = new XMLReader();
try {
    $reader->setSchema('');
} catch (ValueError $exception) {
    echo $exception->getMessage() . "
";
}
$reader->close();

$reader = new XMLReader();
try {
    $reader->setSchema('schema-missing-file.xsd');
} catch (Error $exception) {
    echo $exception->getMessage() . "
";
}
$reader->close();

$reader = new XMLReader();
try {
    $reader->setSchema('schema-empty.xsd');
} catch (Error $exception) {
    echo $exception->getMessage() . "
";
}

$reader = new XMLReader();
$reader->XML(<<<EOF
<?xml version="1.0" encoding="UTF-8" ?>
<foo/>
EOF);
var_dump(@$reader->setSchema('schema-bad.xsd'));
$reader->close();
?>
--EXPECT--
XMLReader::setSchema(): Argument #1 ($filename) cannot be empty
Schema must be set prior to reading
Schema must be set prior to reading
bool(false)

Did this file decode correctly?

Original Code

--TEST--
XMLReader: setSchema Error
--EXTENSIONS--
xmlreader
--FILE--
<?php

$reader = new XMLReader();
try {
    $reader->setSchema('');
} catch (ValueError $exception) {
    echo $exception->getMessage() . "\n";
}
$reader->close();

$reader = new XMLReader();
try {
    $reader->setSchema('schema-missing-file.xsd');
} catch (Error $exception) {
    echo $exception->getMessage() . "\n";
}
$reader->close();

$reader = new XMLReader();
try {
    $reader->setSchema('schema-empty.xsd');
} catch (Error $exception) {
    echo $exception->getMessage() . "\n";
}

$reader = new XMLReader();
$reader->XML(<<<EOF
<?xml version="1.0" encoding="UTF-8" ?>
<foo/>
EOF);
var_dump(@$reader->setSchema('schema-bad.xsd'));
$reader->close();
?>
--EXPECT--
XMLReader::setSchema(): Argument #1 ($filename) cannot be empty
Schema must be set prior to reading
Schema must be set prior to reading
bool(false)

Function Calls

None

Variables

None

Stats

MD5 1aae69bfb1a13a03d221d159b45a2496
Eval Count 0
Decode Time 83 ms