jphp-group / jphp

JPHP - an implementation of PHP on Java VM
http://jphp.develnext.org
Apache License 2.0
1.71k stars 160 forks source link

Cannot concatenate in arrays inside of class constants #395

Closed danog closed 4 years ago

danog commented 4 years ago

Cannot concatenate or do other basic (arithmetical) operations on constants while defining class constants (but only inside of arrays).

Code:

<?php

class a
{
    private const SENSITIVE_HEADERS = ['a'.'b'];
}

Result:

[daniil@daniil-arch jav]$ jppm start
-> linux
-> app:run 
-> install 

Fatal error: Uncaught Error: Expecting constant value for a::SENSITIVE_HEADERS in res://t.php on line 4, position 13
Stack Trace:
#0 {main}
  thrown in res://t.php on line 4

If using the value directly (private const SENSITIVE_HEADERS = 'a'.'b';, without the array) everything works fine.