Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing object using brackets does not work [] #143

Open
itsdarrylnorris opened this issue Nov 19, 2020 · 3 comments
Open

Accessing object using brackets does not work [] #143

itsdarrylnorris opened this issue Nov 19, 2020 · 3 comments

Comments

@itsdarrylnorris
Copy link

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?

@krDhiraj
Copy link

krDhiraj commented Nov 2, 2021

Hey @sanmai,

We are also facing same problem. Kindly help us by including this as a feature.
If needed, we can also share the solution we have implemented for ourself.
Let us know if you need pull request for this.

@sanmai
Copy link
Collaborator

sanmai commented Nov 2, 2021

@krDhiraj If you feel like going out your way and fixing this issue with a pull request, please do. I'll try to review it, especially if it comes with a bunch of tests.

Just to be absolutely clear, I'm not going to fix this issue on my own accord, citing various constraints.

@live627
Copy link

live627 commented Feb 12, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants