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 broken boolean as right-hand operand --SKIPIF-- <?php if (!extension_loaded(..

Decoded Output download

--TEST--
Test broken boolean as right-hand operand
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$jsonPath = new \JsonPath\JsonPath();

$data = [
  'words' => [
     [
      'isAdjective' => true,
      'value'       => 'soggy',
    ],
    [
      'isAdjective' => true,
      'value'       => 'minor',
    ],
    [
      'isAdjective' => true,
      'value'       => 'elated',
    ],
    [
      'isAdjective' => true,
      'value'       => 'unnatural',
    ],
    [
      'isAdjective' => true,
      'value'       => 'grubby',
    ],
  ],
];

$jsonPath = new \JsonPath\JsonPath();
$result = $jsonPath->find($data, "$.words[?(@.isAdjective == truse)]");

var_dump($result);
?>
--EXPECTF--
Fatal error: Uncaught JsonPath\JsonPathException: Expected `true` or `false` for boolean token in %s
Stack trace:
%s
%s
%s

Did this file decode correctly?

Original Code

--TEST--
Test broken boolean as right-hand operand
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$jsonPath = new \JsonPath\JsonPath();

$data = [
  'words' => [
     [
      'isAdjective' => true,
      'value'       => 'soggy',
    ],
    [
      'isAdjective' => true,
      'value'       => 'minor',
    ],
    [
      'isAdjective' => true,
      'value'       => 'elated',
    ],
    [
      'isAdjective' => true,
      'value'       => 'unnatural',
    ],
    [
      'isAdjective' => true,
      'value'       => 'grubby',
    ],
  ],
];

$jsonPath = new \JsonPath\JsonPath();
$result = $jsonPath->find($data, "$.words[?(@.isAdjective == truse)]");

var_dump($result);
?>
--EXPECTF--
Fatal error: Uncaught JsonPath\JsonPathException: Expected `true` or `false` for boolean token in %s
Stack trace:
%s
%s
%s

Function Calls

None

Variables

None

Stats

MD5 4e4c22eb370778d8c077ea120cfd8f0a
Eval Count 0
Decode Time 86 ms