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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Apr 25 06:01:35 2024 UTC