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

Different parsing of # comment on PHP 8 #3069

Closed
kukulich opened this issue Aug 31, 2020 · 3 comments · Fixed by #3072
Closed

Different parsing of # comment on PHP 8 #3069

kukulich opened this issue Aug 31, 2020 · 3 comments · Fixed by #3072
Milestone

Comments

@kukulich
Copy link
Contributor

Describe the bug
The # comment produces different tokens on PHP 8

Code sample

<?php

#

PHP 7.4

array(2) {
  [0]=>
  array(8) {
    ["type"]=>
    string(10) "T_OPEN_TAG"
    ["code"]=>
    int(382)
    ["content"]=>
    string(6) "<?php
"
    ["line"]=>
    int(1)
    ["column"]=>
    int(1)
    ["length"]=>
    int(5)
    ["level"]=>
    int(0)
    ["conditions"]=>
    array(0) {
    }
  }
  [1]=>
  array(8) {
    ["type"]=>
    string(9) "T_COMMENT"
    ["code"]=>
    int(380)
    ["content"]=>
    string(2) "#
"
    ["line"]=>
    int(2)
    ["column"]=>
    int(1)
    ["length"]=>
    int(1)
    ["level"]=>
    int(0)
    ["conditions"]=>
    array(0) {
    }
  }
}

PHP 8

array(3) {
  [0]=>
  array(8) {
    ["type"]=>
    string(10) "T_OPEN_TAG"
    ["code"]=>
    int(390)
    ["content"]=>
    string(6) "<?php
"
    ["line"]=>
    int(1)
    ["column"]=>
    int(1)
    ["length"]=>
    int(5)
    ["level"]=>
    int(0)
    ["conditions"]=>
    array(0) {
    }
  }
  [1]=>
  array(8) {
    ["code"]=>
    int(388)
    ["type"]=>
    string(9) "T_COMMENT"
    ["content"]=>
    string(1) "#"
    ["line"]=>
    int(2)
    ["column"]=>
    int(1)
    ["length"]=>
    int(1)
    ["level"]=>
    int(0)
    ["conditions"]=>
    array(0) {
    }
  }
  [2]=>
  array(8) {
    ["type"]=>
    string(12) "T_WHITESPACE"
    ["code"]=>
    int(393)
    ["content"]=>
    string(1) "
"
    ["line"]=>
    int(2)
    ["column"]=>
    int(2)
    ["length"]=>
    int(0)
    ["level"]=>
    int(0)
    ["conditions"]=>
    array(0) {
    }
  }
}
@jrfnl
Copy link
Contributor

jrfnl commented Aug 31, 2020

Related to #3027 which didn't take hash comments into account.

I will submit a PR to fix this, though I have a niggling feeling that we may have to undo that at a later stage depending on what the final tokenization for attributes in PHP 8.0 will be.

@jrfnl
Copy link
Contributor

jrfnl commented Aug 31, 2020

PR #3072 should fix this.

@gsherwood gsherwood added this to the 3.5.7 milestone Aug 31, 2020
gsherwood added a commit that referenced this issue Aug 31, 2020
@gsherwood
Copy link
Member

I've merged in the PR from @jrfn (thanks again). Thanks also for the bug report.

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 a pull request may close this issue.

3 participants