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

[PHP] Error for octal numbers with prefix in php8.1 #5026

Closed
noelma opened this issue Nov 28, 2022 · 2 comments · Fixed by #5695
Closed

[PHP] Error for octal numbers with prefix in php8.1 #5026

noelma opened this issue Nov 28, 2022 · 2 comments · Fixed by #5695
Assignees
Labels
kind:bug Bug report or fix PHP [ci] enable extra PHP tests (php/php.editor)
Milestone

Comments

@noelma
Copy link

noelma commented Nov 28, 2022

Apache NetBeans version

Apache NetBeans 15

What happened

In PHP 8.1, it is possible to write octal numbers with the explicit prefix 0o.
https://wiki.php.net/rfc/explicit_octal_notation
https://www.php.net/manual/en/migration81.new-features.php#migration81.new-features.core.octal-literal-prefix

This new octal prefix causes a syntax error
Capture d’écran du 2022-11-28 21-57-56
Capture d’écran du 2022-11-28 21-58-03

How to reproduce

  • In Properties > Sources > PHP Version,
  • Select PHP 8.1,
  • Insert the following code in a PHP file:
    <?php
    
    // PHP ^8.0
    if(016 === 14) {
        echo "016 in octal equals 14 in decimal\n";
    }
    // PHP 8.1+
    if(0o16 === 14) {
        echo "0o16 in octal numbers with the explicit 0o prefix equals 14 in decimal\n";
    }

Did this work correctly in an earlier version?

Apache NetBeans 15

Operating System

Linux version 5.15.0-53-generic running on amd64

JDK

18.0.2-ea; OpenJDK 64-Bit Server VM 18.0.2-ea+9-Ubuntu-222.04; Private Build

Apache NetBeans packaging

Apache NetBeans Snap Package

Anything else

No response

Are you willing to submit a pull request?

No

Code of Conduct

Yes

@noelma noelma added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Nov 28, 2022
@mbien mbien added the PHP [ci] enable extra PHP tests (php/php.editor) label Nov 28, 2022
@KacerCZ
Copy link
Contributor

KacerCZ commented Dec 1, 2022

Reproducible.
This wasn't part of PHP 8.1 support in #3463

@KacerCZ KacerCZ removed the needs:triage Requires attention from one of the committers label Dec 1, 2022
@junichi11 junichi11 self-assigned this Mar 21, 2023
@junichi11 junichi11 added this to the NB18 milestone Mar 21, 2023
junichi11 added a commit to junichi11/netbeans that referenced this issue Mar 22, 2023
- apache#5026
- https://wiki.php.net/rfc/explicit_octal_notation
- Fix lexers
- Fix `PHP81UnhandledError`
- Add unit tests for the parser and the lexer
tmysik added a commit that referenced this issue Mar 23, 2023
…tal-integer-literal-notation

PHP 8.1: Explicit octal integer literal notation #5026
@junichi11 junichi11 linked a pull request Mar 23, 2023 that will close this issue
@junichi11
Copy link
Member

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Bug report or fix PHP [ci] enable extra PHP tests (php/php.editor)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants