Edit report at https://bugs.php.net/bug.php?id=30177&edit=1

 ID:                 30177
 Comment by:         minchuk dot john at gmail dot com
 Reported by:        guth at fiifo dot u-psud dot fr
 Summary:            Allow concatenating in class constant values
 Status:             Open
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 Operating System:   *
 PHP Version:        *
 Block user comment: N
 Private report:     N

 New Comment:

Is this a bug or by design?  This produces the same error.  

        define("ASDF", "5678");

        $qwer = "1234" . ASDF;          //works fine

        $dude = new dude();             //errors here

        class dude {
                public $numbs = "1234" . ASDF;  //error
        }


Previous Comments:
------------------------------------------------------------------------
[2013-01-11 00:46:40] ahar...@php.net

Related To: Bug #63959

------------------------------------------------------------------------
[2004-09-21 12:31:00] guth at fiifo dot u-psud dot fr

Description:
------------
hello,

const is too restrictive in PHP.

I think it could be a good idea that the following code worked as expected.

If the constant is not defined, PHP could print a NOTICE and use the name of 
the constant instead.

Reproduce code:
---------------
<?

define("ROOT", $_SERVER['DOCUMENT_ROOT']);

class FIIFO {

        const PATH = ROOT."/path/to/this/class";



}
?>

Expected result:
----------------
As PATH is a constant,

(FIIFO::PATH == "/www/path/to/this/class") for example.



Actual result:
--------------
A parse error...


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=30177&edit=1

Reply via email to