Skip to content

Fixed static variable in class Lexer.#55

Closed
adrigzr wants to merge 5 commits intowp-cli:masterfrom
adrigzr:master
Closed

Fixed static variable in class Lexer.#55
adrigzr wants to merge 5 commits intowp-cli:masterfrom
adrigzr:master

Conversation

@adrigzr
Copy link
Copy Markdown

@adrigzr adrigzr commented Jun 16, 2014

Pulled from https://github.com/wp-cli/php-cli-tools/pull/3, ignore the composer.json.

Static variables are shared between objects. In this case, we dont want this behaviour because each object has his own different properties.

To test it out, just create 2 Lexer objects and try to do 2 foreach with each one. The second object will be bugged in his loop.

This can also be tested calling 'parse' function at least twice in the same runtime.

@danielbachhuber
Copy link
Copy Markdown
Member

@drakson can you rebase against master and include some tests? thanks

@rantonmattei
Copy link
Copy Markdown

PR #79 fixes that bug. You can close this PR once #79 is merged.

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

Successfully merging this pull request may close these issues.

4 participants