|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-11-01 13:17 UTC] nikic@php.net
-Summary: ::class on objects using string concatenation
+Summary: Accessing class constants on objects in string
interpolation
-Type: Bug
+Type: Feature/Change Request
[2021-11-01 13:17 UTC] nikic@php.net
[2024-07-19 21:47 UTC] cmb@php.net
[2024-07-19 21:47 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2024-07-28 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 03:00:01 2025 UTC |
Description: ------------ The introduced feature ::class on objects is throwing a syntax error when being used in string concatenation using curly braces. Error: PHP Parse error: syntax error, unexpected token "}", expecting "->" or "?->" or "{" or "[" in php shell code on line 1 Test script: --------------- class Test {}; $a = new Test(); echo "Test " . $a::class; echo "Test {$a::class}"; Expected result: ---------------- In my opinion the lines 3 and 4 should output the same result "Test Test"