Is PHP 8.4 not supported?

We are trying to analyse PHP 8.4 code.

It looks like that Sonar doesn’t know all PHP 8.4 features and shows PHP parser failure" for this code:

// 8.4 - Fails with: PHP parser failure"
new DoubleConfigBuilder()->toArray()

vs

// 8.3 - Works with Sonar
new DoubleConfigBuilder()->toArray()

This is highly annoying because it’s a parser error, not something we can just flag as a false positive, execution stops because of that.

Is there any workaround? It is a little disappointing that 8.4 at this time is not fully supported, it’s not that new anymore.

  • Edition: Community
  • Sonarqube Version: v10.7 (96327)
  • How is SonarQube deployed: Docker / AWS EC3
  • What are you trying to achieve: Analysing PHP 8.4 Code
  • What have you tried so far to achieve this: Running Sonar…

It looks like PHP 8.4 is not supported yet based on what is written here GitHub - SonarSource/sonar-php: SonarPHP: PHP static analyzer for SonarQube & SonarLint

Are there any plans or timeline to add 8.4 support?

Hey there!

This should be supported in the latest versions of SonarQube (10.7 came out before PHP 8.4) :wink: See SONARPHP-1540

Only the latest version of SonarQube Community Build is considered active.

Your upgrade path is:

10.7 → 24.12 → 25.5

You may find these resources helpful:

And, we should update the README to reflect this. Thanks for noticing this. I’ll ping the right team.

2 Likes

Hi there!

I confirm what @Colin previously said, we do support this syntax in the latest versions :blush:

And you’re right about the README, it is now updated :wink:

Thank you!

1 Like

Unfortunately we can’t use v25 yet, because the branch analysis plugin won’t work with it, because Sonar was so kind to break the API (intentionally?) in a way that makes it harder for the plugin to adapt to v25. :frowning:

See v1.23 does not work with SonarQube 25.3.0.104237-community · Issue #1049 · mc1arke/sonarqube-community-branch-plugin · GitHub

Just in case anyone else is following this:

A new version of the plugin compatible with the latest Sonar version has been released: Release 25.5.0 · mc1arke/sonarqube-community-branch-plugin · GitHub

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.