Bug #79069 [Opn->Nab]: Property name concatenation triggers deprecated warning

From: Date: Mon, 06 Jan 2020 10:21:03 +0000
Subject: Bug #79069 [Opn->Nab]: Property name concatenation triggers deprecated warning
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224729@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79069&edit=1 ID: 79069 Updated by: nikic@php.net Reported by: gwendal dot ledoussal at jymeo dot net Summary: Property name concatenation triggers deprecated warning -Status: Open +Status: Not a bug Type: Bug Package: Unknown/Other Function Operating System: MacOS PHP Version: 7.4.1 Block user comment: N Private report: N New Comment: $this->foo_{$bar} is an array access, as the deprecation warning correctly indicates. It does not concatenate property names. Previous Comments: ------------------------------------------------------------------------ [2020-01-06 10:20:16] bugreports at gmail dot com $this->{"foo_{$bar}"} = true; ------------------------------------------------------------------------ [2020-01-06 10:13:05] gwendal dot ledoussal at jymeo dot net Description: ------------ PHP 7.4 deprecated array and string offset access with curly braces but it also affect property name concatenation. Test script: --------------- <?php class Foo { public function __construct() { $bar = "bar"; $this->{'foo_' . $bar} = true; // Works $this->foo_{$bar} = true; // Triggers Array and string offset access syntax with curly braces is deprecated } } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79069&edit=1

« previous php.bugs (#224729) next »