Skip to content

Accessing object using brackets does not work [] #143

Open
@itsdarrylnorris

Description

@itsdarrylnorris

Problem / Issue:

I am trying to access a key with space on it, and when I am trying to use the syntax using the brackets, it does not seems to be working.

Here is the example code:

<?php 

require __DIR__ . '/vendor/autoload.php';

use Liquid\Template;

$payload = json_decode('
{
  "name": {
       "Hello World": "foo"
   }
}
', true);

$template = new Template();
$template->parse('Hello, {{ name["Hello World"] }}!');
echo $template->render($payload);

Output

Hello, !% 

I am doing something wrong or missing something? Or this feature is currently not supported?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions