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-- Ensure order of operations are enforced --SKIPIF-- <?php if (!extension_loaded("j..

Decoded Output download

--TEST--
Ensure order of operations are enforced
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$jsonPath = new \JsonPath\JsonPath();

$obj = [
	'test' => [
		[
			"a" => "true",
			"b" => "false",
			"c" => "false"
		]
	]
];

echo "Without parentheses
";
var_dump($jsonPath->find($obj, '$.test[?(@.a == "true" || @.b == "true" && @.c == "true")]'));
echo "With parentheses
";
var_dump($jsonPath->find($obj, '$.test[?((@.a == "true" || @.b == "true") && @.c == "true")]'));
--EXPECT--
Without parentheses
array(1) {
  [0]=>
  array(3) {
    ["a"]=>
    string(4) "true"
    ["b"]=>
    string(5) "false"
    ["c"]=>
    string(5) "false"
  }
}
With parentheses
bool(false)
 ?>

Did this file decode correctly?

Original Code

--TEST--
Ensure order of operations are enforced
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$jsonPath = new \JsonPath\JsonPath();

$obj = [
	'test' => [
		[
			"a" => "true",
			"b" => "false",
			"c" => "false"
		]
	]
];

echo "Without parentheses\n";
var_dump($jsonPath->find($obj, '$.test[?(@.a == "true" || @.b == "true" && @.c == "true")]'));
echo "With parentheses\n";
var_dump($jsonPath->find($obj, '$.test[?((@.a == "true" || @.b == "true") && @.c == "true")]'));
--EXPECT--
Without parentheses
array(1) {
  [0]=>
  array(3) {
    ["a"]=>
    string(4) "true"
    ["b"]=>
    string(5) "false"
    ["c"]=>
    string(5) "false"
  }
}
With parentheses
bool(false)

Function Calls

None

Variables

None

Stats

MD5 96d7511cb96f33ea87345ab6502917c3
Eval Count 0
Decode Time 81 ms