Bug #69754 [NEW]: Use of ::class inside array causes fatal error.

From: Date: Wed, 03 Jun 2015 21:17:44 +0000
Subject: Bug #69754 [NEW]: Use of ::class inside array causes fatal error.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193094@lists.php.net to get a copy of this message
From: salathe@php.net Operating system: PHP version: master-Git-2015-06-03 (Git) Package: Scripting Engine problem Bug Type: Bug Bug description:Use of ::class inside array causes fatal error. Description: ------------ Using ::class within an array appears to mistakenly cause a fatal error. Looks to have been introduced by http://git.php.net/?p=php-src.git;a=commitdiff;h=69b54ba926b714dff0f8b54bea385e9a278c5849 Test script: --------------- <?php class Example { public function test() { $me = static::class; // OK $not_me = static::class . 'IsAwesome'; // OK $day_me = static::class . date('Ymd'); // OK $array_me = [static::class]; // BOOM } } ?> Expected result: ---------------- No output, no errors. Actual result: -------------- Fatal error: static::class cannot be used for compile-time class name resolution in /in/PMShY on line 10 -- Edit bug report at https://bugs.php.net/bug.php?id=69754&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69754&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69754&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69754&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69754&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69754&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69754&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69754&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69754&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69754&r=support Expected behavior: https://bugs.php.net/fix.php?id=69754&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69754&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69754&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69754&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69754&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69754&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69754&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69754&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69754&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69754&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69754&r=mysqlcfg

« previous php.bugs (#193094) next »