|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74964 'object' is not reserved at linting time
Submitted: 2017-07-21 14:04 UTC Modified: 2017-08-02 15:35 UTC
Avg. Score:3.5 ± 0.9
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 7.2.0beta1 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2017-07-21 14:04 UTC]
it is possible to lint PHP script, and be warned about usage of 'int' or 'float' but not 'object'.

with 'class int', php -l yields : 
Cannot use 'int' as class name as it is reserved 

with 'class object', php -l yields : 
No syntax errors detected

Test script:

class int {}

class object {}


Expected result:
Consistent error message with 'int' at linting time : 

Cannot use 'object' as class name as it is reserved 

Actual result:
No syntax errors detected


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-24 22:17 UTC] michal dot brzuchalski at gmail dot com
I did checkout PHP-7.2 branch and the expected warning seems working properly, here's the listing:

Test script:

//class int {}

class object {}


Actual result:
Fatal error: Cannot use 'object' as class name as it is reserved in bug74964.php on line 5
Errors parsing bug74964.php
 [2017-07-24 22:21 UTC] michal dot brzuchalski at gmail dot com
Lint stops when FatalError occurred, maybe that's why your original test script is only showing error on 'class int' ?!
 [2017-08-02 15:35 UTC]
-Status: Open +Status: Not a bug
 [2017-08-02 15:35 UTC]
Yes, you're right.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 13:01:29 2024 UTC