php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #27102 Reserve the promised keywords private, public and protected earlier for ...
Submitted: 2004-01-31 05:50 UTC Modified: 2004-01-31 06:53 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: tokie at hanmail dot net Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.3.5RC1 OS: All
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-01-31 05:50 UTC] tokie at hanmail dot net
Description:
------------
I've been waitning for the version 5 of PHP. and I've been actually preparing for the next major release of PHP like this:

<?php
class SiteBase {
    function __construct() { // do something }

    // for PHP 4.x
    function SiteBase() { $this->__construct(); }

    // public
    function Show() { ... }

    // private
    function IsRoot() { ... }
} // end class
?>

and because public, private or protected modifiers are not yet keywords in 4.x so I had to comment them every time.

But I think it would be better if the PHP 4.x just can recognise them as keywords but do nothing for them. I mean they can be "reserved" for the next version of PHP.

Expected result:
----------------
<?php
class PHP5Class { // but it will work in PHP4 too.
    public $Var1;
    private $Var2;
    protected $var3; // works in PHP4 but the modifier 'protected' will be ignored and replaced with 'var' and so on.

     // 'static' or 'final' also ingored in PHP 4
    static protected function F1() { ... }
   
    // but this should not be permitted because the name 'protected' is reserved
    function protected() { ... }

}
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-31 06:53 UTC] derick@php.net
It would have been nice if we did this from 4.3.0 on, but if we do it now it would really matter anymore, and also we are now in bug0-fix only mode for PHP 4. (And obviously this request doesn't make sense for PHP 5).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 26 14:01:32 2024 UTC