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-- Check for jsonschema bool error --SKIPIF-- <?php if (!extension_loaded("jso..

Decoded Output download

--TEST--
Check for jsonschema bool error
--SKIPIF--

<?php
if (!extension_loaded("jsonschema"))
    print "skip";
?>
--FILE--
<?php
/* boolean */
$value = 12;
$jsonSchema = new JsonSchema();
echo 'boolean:';
echo assert(!$jsonSchema->validate(array(
            'type' => 'boolean',
            'default' => false,
                ), $value));
echo ',', count($jsonSchema->getErrors()), PHP_EOL;

/* integer or boolean */
echo 'integer or boolean:';
$value = "a string";
$jsonSchema = new JsonSchema();

echo assert(!$jsonSchema->validate(array(
            'type' => array('boolean', 'integer'),
            'default' => false,
                ), $value));
echo ',', count($jsonSchema->getErrors());

$value = 123.321;
$jsonSchema = new JsonSchema();
echo ',', assert(!$jsonSchema->validate(array(
            'type' => array('boolean', 'integer'),
            'default' => false,
                ), $value));
echo ',', count($jsonSchema->getErrors()), PHP_EOL;
?>
--EXPECT--
boolean:1,1
integer or boolean:1,2,1,2

Did this file decode correctly?

Original Code

--TEST--
Check for jsonschema bool error
--SKIPIF--

<?php
if (!extension_loaded("jsonschema"))
    print "skip";
?>
--FILE--
<?php
/* boolean */
$value = 12;
$jsonSchema = new JsonSchema();
echo 'boolean:';
echo assert(!$jsonSchema->validate(array(
            'type' => 'boolean',
            'default' => false,
                ), $value));
echo ',', count($jsonSchema->getErrors()), PHP_EOL;

/* integer or boolean */
echo 'integer or boolean:';
$value = "a string";
$jsonSchema = new JsonSchema();

echo assert(!$jsonSchema->validate(array(
            'type' => array('boolean', 'integer'),
            'default' => false,
                ), $value));
echo ',', count($jsonSchema->getErrors());

$value = 123.321;
$jsonSchema = new JsonSchema();
echo ',', assert(!$jsonSchema->validate(array(
            'type' => array('boolean', 'integer'),
            'default' => false,
                ), $value));
echo ',', count($jsonSchema->getErrors()), PHP_EOL;
?>
--EXPECT--
boolean:1,1
integer or boolean:1,2,1,2

Function Calls

extension_loaded 1

Variables

$value 12

Stats

MD5 4915d70c2737c89bd561439474096150
Eval Count 0
Decode Time 114 ms