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

Sniffing for #275

Closed
PatrickRose opened this issue Oct 6, 2016 · 4 comments
Closed

Sniffing for #275

PatrickRose opened this issue Oct 6, 2016 · 4 comments
Milestone

Comments

@PatrickRose
Copy link

Arguably we shouldn't have written this anyway, but we've found that the following is now a compile time error in PHP instead of a runtime error:

$ less tmp.php
<?php

function hello() {
    if (true) {
        continue;
    }
}
$ php56 tmp.php

$ php70 tmp.php
PHP Fatal error:  'continue' not in the 'loop' or 'switch' context in tmp.php on line 5

It was a fatal runtime error in PHP5.6 but because it was nested inside some error handling code in our case it was never hit. Same is true with break.

@wimg
Copy link
Member

wimg commented Oct 16, 2016

Sadly this is one that will be extremely hard to detect. In fact we can never cover all cases of this. Unless someone has a brilliant idea for this ? @jrfnl ?

@jrfnl
Copy link
Member

jrfnl commented Oct 16, 2016

@wimg I am already thinking about it, got some ideas, but will need to test them out to be sure ;-)

@jrfnl
Copy link
Member

jrfnl commented Oct 16, 2016

Ok, I think I've got it, now off to build it.

@jrfnl
Copy link
Member

jrfnl commented Oct 17, 2016

Ok, this should work. PR #278 should handle this. Testing appreciated, including coming up with more test cases to see if the sniff handles them correctly.

@wimg wimg closed this as completed in #278 Oct 20, 2016
@jrfnl jrfnl added this to the 7.0.7 milestone May 1, 2017
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

3 participants