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

"class die {}" shows invalid error message #17495

Closed
ohyeaah opened this issue Jan 17, 2025 · 3 comments
Closed

"class die {}" shows invalid error message #17495

ohyeaah opened this issue Jan 17, 2025 · 3 comments

Comments

@ohyeaah
Copy link

ohyeaah commented Jan 17, 2025

Description

The following code:

<?php class die {}

Resulted in this output:

Parse error: syntax error, unexpected token "exit", expecting identifier in /in/84ai5 on line 1

But I expected this output instead:

Parse error: syntax error, unexpected token "die", expecting identifier in /in/84ai5 on line 1

PHP Version

PHP 8.4.3

Operating System

3v4l

@TimWolla
Copy link
Member

Both exit and die are parsed as the same token T_EXIT internally. The impact of splitting them into two different tokens (e.g. for tools using token_get_all()) is probably not worth the slightly improved error message here.

@nielsdos
Copy link
Member

Agreed, for me this is a "won't fix" as well. You normally won't see this in normal code.

@Girgias
Copy link
Member

Girgias commented Jan 17, 2025

This is also long-standing behaviour, so I agree on the won't fix and will close the issue as such.

@Girgias Girgias closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2025
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

4 participants