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-- Test DOMDocument::createAttribute() for expected exception thrown when wrong para..

Decoded Output download

--TEST--
Test DOMDocument::createAttribute() for expected exception thrown when wrong parameter passed
--EXTENSIONS--
dom
--FILE--
<?php
$dom = new DOMDocument();

try {
    $attr = $dom->createAttribute(0);
}
catch(DOMException $e) {
    $code = $e->getCode();
    if(DOM_INVALID_CHARACTER_ERR === $code) {
        echo "PASS";
    }
    else {
        echo 'Wrong exception code';
    }
}
catch(Exception $e) {
    echo 'Wrong exception thrown';
}

?>
--EXPECT--
PASS

Did this file decode correctly?

Original Code

--TEST--
Test DOMDocument::createAttribute() for expected exception thrown when wrong parameter passed
--EXTENSIONS--
dom
--FILE--
<?php
$dom = new DOMDocument();

try {
    $attr = $dom->createAttribute(0);
}
catch(DOMException $e) {
    $code = $e->getCode();
    if(DOM_INVALID_CHARACTER_ERR === $code) {
        echo "PASS";
    }
    else {
        echo 'Wrong exception code';
    }
}
catch(Exception $e) {
    echo 'Wrong exception thrown';
}

?>
--EXPECT--
PASS

Function Calls

None

Variables

None

Stats

MD5 942923b1efd7201c4aef3c1790fb247d
Eval Count 0
Decode Time 86 ms