harrydeluxe / php-liquid

A PHP port of Ruby's Liquid Templates
http://www.delacap.com/artikel/Liquid-Templates/
MIT License
239 stars 117 forks source link

Context tries to access private properties where public methods exists #42

Closed sanmai closed 7 years ago

sanmai commented 7 years ago

Consider the following class definition.

class Example
{
    private $name = null;

    public function name()
    {
        return $this->name;
    }
}

If you happen to include an instance of this class in a template, then try to access the name like so:

{{ example.name }}

You will get a fatal error:

PHP Fatal error:  Uncaught Error: Cannot access private property Example::$name
sanmai commented 7 years ago

Closed in #41