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-- uri_template() invalid expression - error 7 "{!hello}" --FILE-- <?php $data = ar..

Decoded Output download

--TEST--
uri_template() invalid expression - error 7 "{!hello}"
--FILE--
<?php

$data = array(
  "id"          => "thing",
  "var"         => "value",
  "hello"       => "Hello World!",
  "empty"       => "",
  "path"        => "/foo/bar",
  "x"           => "1024",
  "y"           => "768",
  "list"        => array("red", "green", "blue"),
  "keys"        => array(
    "semi" => ";", 
    "dot" => ".", 
    "comma" => ","
  ),
  "example"     => "red",
  "searchTerms" => "uri templates"
);

uri_template("{!hello}", $data, $result);

var_dump($result);
?>
--EXPECT--
array(3) {
  ["result"]=>
  string(8) "{!hello}"
  ["state"]=>
  int(3)
  ["expressions"]=>
  array(1) {
    [0]=>
    array(7) {
      ["op"]=>
      string(0) ""
      ["sep"]=>
      string(1) ","
      ["ifemp"]=>
      string(0) ""
      ["allow"]=>
      bool(false)
      ["named"]=>
      bool(false)
      ["error"]=>
      bool(true)
      ["vars"]=>
      array(1) {
        [0]=>
        array(3) {
          ["name"]=>
          string(6) "!hello"
          ["length"]=>
          int(0)
          ["explode"]=>
          bool(false)
        }
      }
    }
  }
}

Did this file decode correctly?

Original Code

--TEST--
uri_template() invalid expression - error 7 "{!hello}"
--FILE--
<?php

$data = array(
  "id"          => "thing",
  "var"         => "value",
  "hello"       => "Hello World!",
  "empty"       => "",
  "path"        => "/foo/bar",
  "x"           => "1024",
  "y"           => "768",
  "list"        => array("red", "green", "blue"),
  "keys"        => array(
    "semi" => ";", 
    "dot" => ".", 
    "comma" => ","
  ),
  "example"     => "red",
  "searchTerms" => "uri templates"
);

uri_template("{!hello}", $data, $result);

var_dump($result);
?>
--EXPECT--
array(3) {
  ["result"]=>
  string(8) "{!hello}"
  ["state"]=>
  int(3)
  ["expressions"]=>
  array(1) {
    [0]=>
    array(7) {
      ["op"]=>
      string(0) ""
      ["sep"]=>
      string(1) ","
      ["ifemp"]=>
      string(0) ""
      ["allow"]=>
      bool(false)
      ["named"]=>
      bool(false)
      ["error"]=>
      bool(true)
      ["vars"]=>
      array(1) {
        [0]=>
        array(3) {
          ["name"]=>
          string(6) "!hello"
          ["length"]=>
          int(0)
          ["explode"]=>
          bool(false)
        }
      }
    }
  }
}

Function Calls

uri_template 1

Variables

$data [{'key': 'id', 'value': 'thing'}, {'key': 'var', 'value': 'value'}, {'key': 'hello', 'value': 'Hello World!'}, {'key': 'empty', 'value': ''}, {'key': 'path', 'value': '/foo/bar'}, {'key': 'x', 'value': '1024'}, {'key': 'y', 'value': '768'}, {'key': 'list', 'value': [{'key': 0, 'value': 'red'}, {'key': 1, 'value': 'green'}, {'key': 2, 'value': 'blue'}]}, {'key': 'keys', 'value': [{'key': 'semi', 'value': ';'}, {'key': 'dot', 'value': '.'}, {'key': 'comma', 'value': ','}]}, {'key': 'example', 'value': 'red'}, {'key': 'searchTerms', 'value': 'uri templates'}]

Stats

MD5 ee91c390f4e973aabb07d944389b4834
Eval Count 0
Decode Time 85 ms