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

Undefined property: PHPTAL_Php_CodeWriter::$_indentation #48

Closed
herndlm opened this issue Feb 17, 2016 · 4 comments
Closed

Undefined property: PHPTAL_Php_CodeWriter::$_indentation #48

herndlm opened this issue Feb 17, 2016 · 4 comments

Comments

@herndlm
Copy link

herndlm commented Feb 17, 2016

Hi there,

I'm using the latest PHPTAL 1.3.0 via pear and have a project that catches notices and I get the following:

Array
(
    [type] => 8
    [message] => Undefined property: PHPTAL_Php_CodeWriter::$_indentation
    [file] => /usr/share/pear/PHPTAL/Php/CodeWriter.php
    [line] => 143
)

There seem to be cases where this property never gets created but the "indent" method tries to access and modify it. Can I help debugging this or do you have a fix for me?

@Potherca
Copy link
Member

Hi! Thanks for taking the time to report this.

I've delved into this a bit. Looking in the code of PHPTAL_Php_CodeWriter, the private property $_indentation is set to 0 when the class is instantiated. The bug you describe has been reported and fixed previously in 2013.

Can you confirm the source-code you have does indeed have private $_indentation = 0; on line 502 of PHPTAL_Php_CodeWriter.php?

If this is indeed the case, do you happen to have a reproducible use-case so we can confirm this behaviour?

@herndlm
Copy link
Author

herndlm commented Mar 21, 2016

Hi, thx for looking into this. Yes, this is set to 0 as in

$ grep -n '$_indentation' /usr/share/pear/PHPTAL/Php/CodeWriter.php
502:    private $_indentation = 0;

I don't have a use-case right now, but I'll try to find / create one. Thx again

EDIT: sorry the error was from our live system and I did the grep on the testing system. looks like phptal is not up-to-date on the live system (we have 1.2.2 there). sorry for bothering you

@herndlm
Copy link
Author

herndlm commented Mar 21, 2016

Fyi while upgrading via pear we noticed that http://phptal.org/latest.tar.gz does currently not point to the latest (1.3.0) version but to 1.2.2 instead. Also we had to download the file manually because pear threw some SSL errors and "pear upgrade" did also not work because of conflicting files. Uninstalling and a fresh "pear install" finally worked. frustrating pear..

@Potherca
Copy link
Member

sorry for bothering you

Things should work and it can be frustrating when they don't. We are here to help so no need to apologise!

Although @Ocramius and myself are active maintainers of this repository, we do not have access/control over http://phptal.com/. I'll take this up with @pornel in a separate issue and see what we can do to resolve this.

In closing: there has been some discussion on eventually dropping PEAR support in favour of Composer. This is bound to happen at some point in the future, so it might be worth the effort of preparing for that outcome.

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

No branches or pull requests

2 participants