marcioAlmada / yay

Yay is a high level PHP preprocessor
https://github.com/marcioAlmada/yay
MIT License
572 stars 35 forks source link

Fix access to undefined stack index on `ExpressionParser` #67

Open marcioAlmada opened 5 years ago

marcioAlmada commented 5 years ago

Follow up to #64

marcioAlmada commented 5 years ago
1) Yay\ParserOptimizationTest::testExpressionParserWithGoodExpressions with data set
"Expression 446" ('3 << 3 >> 2 . 2', true)

The behavior of unparenthesized expressions containing both '.' and '>>'/'<<'
 will change in PHP 8:  '<<'/'>>' will take a higher precedence

There are still some precedence changes on some operators though, these last failures will require some thought. The ExpressionParser will have to be conditionally different regarding the PHP version.

BTW we should be thankfull these warnings were added, this is something nobody would notice without the engine warnings/notices.

e1himself commented 3 years ago

1) Yay\ParserOptimizationTest::testExpressionParserWithGoodExpressions with data set "Expression 446" ('3 << 3 >> 2 . 2', true)

The behavior of unparenthesized expressions containing both '.' and '>>'/'<<' will change in PHP 8: '<<'/'>>' will take a higher precedence

There are still some precedence changes on some operators though, these last failures will require some thought. The ExpressionParser will have to be conditionally different regarding the PHP version.

BTW we should be thankfull these warnings were added, this is something nobody would notice without the engine warnings/notices.

IMO you should not fix these in your tests. Even though these are rightful warnings from PHP that the code generated might be not what you want. Nevertheless, it's still 100% valid PHP syntax. The tool did exactly what it was told to. So I don't see a problem.