Bug #81583 [NEW]: ::class on objects using string concatenation

From: Date: Mon, 01 Nov 2021 10:03:59 +0000
Subject: Bug #81583 [NEW]: ::class on objects using string concatenation
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237483@lists.php.net to get a copy of this message
From:             php at crmteam dot cytainment dot de
Operating system: Debian 10
PHP version:      8.0.12
Package:          *General Issues
Bug Type:         Bug
Bug description:::class on objects using string concatenation

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"


-- 
Edit bug report at https://bugs.php.net/bug.php?id=81583&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81583&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81583&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81583&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81583&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81583&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81583&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81583&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81583&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81583&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81583&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81583&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81583&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81583&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81583&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81583&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81583&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81583&r=mysqlcfg


Thread (6 messages)

« previous php.bugs (#237483) next »