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 that an exception is thrown when ERRMODE_EXCEPT is set --SKIPIF-- <?php if ..

Decoded Output download

--TEST--
Test that an exception is thrown when ERRMODE_EXCEPT is set 
--SKIPIF--
<?php if (!extension_loaded("jsonreader")) print "skip"; ?>
--STDIN--
{ 12: "<= Numeric keys are not valid in JSON!" }
--FILE--
<?php
$rdr = new JSONReader(array(
  JSONReader::ATTR_ERRMODE => JSONReader::ERRMODE_EXCEPT
));
$rdr->open('php://stdin');
try {
  while ($rdr->read()) {
    echo "- $rdr->tokenType
";
  }
} catch (JSONReaderException $e) {
  echo "EX: {$e->getCode()} {$e->getMessage()}
";
}
$rdr->close();
?>
--EXPECTF--
- %d
EX: %d Unexpected character in input: '1' (0x31)

Did this file decode correctly?

Original Code

--TEST--
Test that an exception is thrown when ERRMODE_EXCEPT is set 
--SKIPIF--
<?php if (!extension_loaded("jsonreader")) print "skip"; ?>
--STDIN--
{ 12: "<= Numeric keys are not valid in JSON!" }
--FILE--
<?php
$rdr = new JSONReader(array(
  JSONReader::ATTR_ERRMODE => JSONReader::ERRMODE_EXCEPT
));
$rdr->open('php://stdin');
try {
  while ($rdr->read()) {
    echo "- $rdr->tokenType\n";
  }
} catch (JSONReaderException $e) {
  echo "EX: {$e->getCode()} {$e->getMessage()}\n";
}
$rdr->close();
?>
--EXPECTF--
- %d
EX: %d Unexpected character in input: '1' (0x31)

Function Calls

extension_loaded 1

Variables

None

Stats

MD5 83ea9bc7f30a0cfce186e1729e752073
Eval Count 0
Decode Time 85 ms