Bug #69754 [Asn->Csd]: Use of ::class inside array causes fatal error.
Edit report at https://bugs.php.net/bug.php?id=69754&edit=1
ID: 69754
Updated by: bwoebi@php.net
Reported by: salathe@php.net
Summary: Use of ::class inside array causes fatal error.
-Status: Assigned
+Status: Closed
Type: Bug
Package: Scripting Engine problem
PHP Version: master-Git-2015-06-03 (Git)
Assigned To: bwoebi
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1d3f77d13d2b457bdf1bc52045da4679741e65cb
Log: Fix Bug #69754 (Compile failure with ::class in array)
Previous Comments:
------------------------------------------------------------------------
[2015-06-03 21:17:43] salathe@php.net
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 this bug report at https://bugs.php.net/bug.php?id=69754&edit=1
Thread (2 messages)