Page MenuHomePhabricator

PHP 7 compatibility: Embedded variable syntax
Closed, ResolvedPublic

Description

The new PHP7 parser and AST interpret a few edge cases differently from the PHP5 parser. The PHAN tool (https://github.com/etsy/phan) is able to detect these. We should scan for these and make sure we're not using them.

https://www.youtube.com/watch?v=eOCyPxqFSTI&t=16m

Screen Shot 2015-12-07 at 18.40.20.png (773×1 px, 512 KB)

Event Timeline

Krinkle raised the priority of this task from to Needs Triage.
Krinkle updated the task description. (Show Details)
Krinkle subscribed.

I ran php7mar against this and did not find any current instances PHP 7 breaking variable interpolation. I could not get phan to work as it just produces segmentation faults.

Would prefer a second glance with another tool to verify my results.

I ran phan against latest core code. It did not find any instances of issues with embedded variable syntax.

I temporarily added a few instances of embedded variable syntax locally just to confirm that I had phan configured properly, and it did successfully find them. It did.

Given that the concern is a change in syntax interpretation between PHP5 and PHP7, and we are now on PHP7, there should be no future problems of this sort. The only reason I can think of that we'd encounter an inconsistency in the future is if someone pasted PHP5 code from somewhere like Stack Exchange, and the pasted code behaved differently under PHP7. This seems an unlikely edge case that should be caught in testing and code review.

In my opinion, we are already be good on this issue, with no further action required.