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 array slice with strings as start, end, and step --SKIPIF-- <?php if (!exten..

Decoded Output download

--TEST--
Test array slice with strings as start, end, and step
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$jsonPath = new \JsonPath\JsonPath();

$data = [
  'words' => [
    'soggy',
    'minor',
    'elated',
    'unnatural',
    'grubby',
    'fabulous',
    'parsimonious',
    'cheerful',
    'unadvised',
    'simplistic',
  ],
];

$jsonPath = new \JsonPath\JsonPath();
$result = $jsonPath->find($data, "$.words['first':'last':'two']");

var_dump($result);
?>
--EXPECTF--
Fatal error: Uncaught JsonPath\JsonPathException: Expected slice separator `:` or integer, got LEX_LITERAL in slice union filter in %s
Stack trace:
%s
%s
%s

Did this file decode correctly?

Original Code

--TEST--
Test array slice with strings as start, end, and step
--SKIPIF--
<?php if (!extension_loaded("jsonpath")) print "skip"; ?>
--FILE--
<?php

$jsonPath = new \JsonPath\JsonPath();

$data = [
  'words' => [
    'soggy',
    'minor',
    'elated',
    'unnatural',
    'grubby',
    'fabulous',
    'parsimonious',
    'cheerful',
    'unadvised',
    'simplistic',
  ],
];

$jsonPath = new \JsonPath\JsonPath();
$result = $jsonPath->find($data, "$.words['first':'last':'two']");

var_dump($result);
?>
--EXPECTF--
Fatal error: Uncaught JsonPath\JsonPathException: Expected slice separator `:` or integer, got LEX_LITERAL in slice union filter in %s
Stack trace:
%s
%s
%s

Function Calls

None

Variables

None

Stats

MD5 57ed03f65af3f14b862417ae9d7715c3
Eval Count 0
Decode Time 93 ms