Bug #67225 [Asn->Sus]: Parser accepts Arrays as class-constants
| From: | bwoebi@php.net | Date: | Thu, 08 May 2014 21:14:11 +0000 |
| Subject: | Bug #67225 [Asn->Sus]: Parser accepts Arrays as class-constants | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-185731@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67225&edit=1
ID: 67225
Updated by: bwoebi@php.net
Reported by: sjon at hortensius dot net
Summary: Parser accepts Arrays as class-constants
-Status: Assigned
+Status: Suspended
Type: Bug
Package: Compile Failure
Operating System: Archlinux
PHP Version: 5.6.0beta2
Assigned To: bwoebi
Block user comment: N
Private report: N
New Comment:
The error message clearly says _at run-time_. If you use it in compile-time only constructs, no
problem.
I'll need to talk to other people later, but I'm relatively busy as of now.
Suspending for the next few weeks.
Previous Comments:
------------------------------------------------------------------------
[2014-05-07 11:16:09] sjon at hortensius dot net
Description:
------------
I have been going through 3v4l.org submitted scripts to find anomalies in 5.6.0-beta2; and I found
http://3v4l.org/8Yl8V where the parser accepts an Array as
class-constant; but when using that constant you still get a fatal error. This seems incorrect.
Here you see 5.6.0-beta2 incorrectly doesn't generate a fatal error: http://3v4l.org/8Yl8V
Here you see it does generate an error when using the const: http://3v4l.org/LG2EM
Test script:
---------------
<?php
interface exampleInterface
{
const _TYPE = array(
"name1" => "0",
"name2" => "1",
"name3" => "2"
);
public function x();
}
// Uncommenting this shows a Fatal error; but it should be show regardless
//class A implements exampleInterface { public function x(){var_dump(self::_TYPE);}}$a = new
A;$a->x();
Expected result:
----------------
Fatal error: Arrays are not allowed in constants at run-time in /in/LG2EM on line 19
Process exited with code 255.
Actual result:
--------------
""
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67225&edit=1