Bug #67225 [NEW]: Parser accepts Arrays as class-constants
| From: | sjon at hortensius dot net | Date: | Wed, 07 May 2014 11:16:10 +0000 |
| Subject: | Bug #67225 [NEW]: Parser accepts Arrays as class-constants | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-185687@lists.php.net to get a copy of this message | ||
From: sjon at hortensius dot net
Operating system: Archlinux
PHP version: 5.6.0beta2
Package: Compile Failure
Bug Type: Bug
Bug description:Parser accepts Arrays as class-constants
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 bug report at https://bugs.php.net/bug.php?id=67225&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67225&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67225&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67225&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=67225&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=67225&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=67225&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=67225&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=67225&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=67225&r=support
Expected behavior: https://bugs.php.net/fix.php?id=67225&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=67225&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=67225&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=67225&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67225&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=67225&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=67225&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=67225&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=67225&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=67225&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=67225&r=mysqlcfg