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

[bug] parens and staticlookup #185

Closed
alexander-akait opened this issue Sep 19, 2018 · 7 comments
Closed

[bug] parens and staticlookup #185

alexander-akait opened this issue Sep 19, 2018 · 7 comments
Assignees
Labels
AST bug RELEASE-READY Waiting to release

Comments

@alexander-akait
Copy link
Collaborator

$var = ($var[0])::foo;
$var = ($var[0][1])::foo;
$var = ($var[0])[1]::foo;
$var = (($var[0])[1])::foo;
$var = (new Foo())::bar;

Problem exists in master

@alexander-akait alexander-akait changed the title parens and staticlookup [bug] parens and staticlookup Sep 19, 2018
@ichiriac ichiriac self-assigned this Sep 29, 2018
@alexander-akait
Copy link
Collaborator Author

Here other big bug

get_class($this->resource)::$wrap;

@ichiriac
Copy link
Member

ichiriac commented Oct 5, 2018

not sure yet, but seems that this bug existed before

@alexander-akait
Copy link
Collaborator Author

maybe 😞

@alexander-akait
Copy link
Collaborator Author

Need also fix:

get_class($var)::$$$$$property;

@ichiriac
Copy link
Member

Ok, for $$$$$property I'm not enough permissive here : https://github.com/glayzzle/php-parser/blob/master/src/parser/variable.js#L154

@ichiriac
Copy link
Member

other bugs are from : https://github.com/glayzzle/php-parser/blob/master/src/parser/variable.js#L232 and introduced here #179

I've forced the call as the bugfix request was over staticlookup with call functions, but here we are working on another branch :

simple_variable:
		T_VARIABLE			{ $$ = $1; }
	|	'$' '{' expr '}'	{ $$ = $3; }
	|	'$' simple_variable	{ $$ = zend_ast_create(ZEND_AST_VAR, $2); }
;
static_member:
		class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
			{ $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
	|	variable_class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable
			{ $$ = zend_ast_create(ZEND_AST_STATIC_PROP, $1, $3); }
;

In principle it's fixed, but can you please provide more tests and check if it's not too permissive.

@ichiriac ichiriac added the RELEASE-READY Waiting to release label Nov 18, 2018
@ichiriac
Copy link
Member

ichiriac commented Jan 7, 2019

released in 3.0.0-prerelease.8

@ichiriac ichiriac closed this as completed Jan 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AST bug RELEASE-READY Waiting to release
Projects
None yet
Development

No branches or pull requests

2 participants