php.net |  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
Votes:4
Avg. Score:3.5 ± 0.9
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: dams@php.net Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 7.2.0beta1 OS: Any
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dams@php.net
New email:
PHP Version: OS:

 

 [2017-07-21 14:04 UTC] dams@php.net
Description:
------------
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:
---------------
<?php

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

Patches

Pull Requests

History

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:
---------------
<?php

//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] dams@php.net
-Status: Open +Status: Not a bug
 [2017-08-02 15:35 UTC] dams@php.net
Yes, you're right.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC