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

Objects are not converted to strings (e.g. using __toString()) #38

Open
vdboor opened this issue Jul 20, 2011 · 1 comment
Open

Objects are not converted to strings (e.g. using __toString()) #38

vdboor opened this issue Jul 20, 2011 · 1 comment

Comments

@vdboor
Copy link
Contributor

vdboor commented Jul 20, 2011

When a VariableNode() resolves an object, it is not printed as string.
This could be done using the __toString() method.

Where could this be implemented?
The source was a bit unclear for me, whether that needs to happen in resolve(), getVariable() or escape()

@speedmax
Copy link
Owner

I would recommend fork h2o, then add additional logic in Context#resolve before the return value before the applyFilters

  function resolve($var) {
  ....

  if (is_object($result)) {
        // check existence of __toString on the class definition then overwrite $result
  }

  $result = $this->applyFilters($result,$filters);
    return $result;
}

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

No branches or pull requests

2 participants