|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79069 Property name concatenation triggers deprecated warning
Submitted: 2020-01-06 10:13 UTC Modified: 2020-01-06 10:21 UTC
From: gwendal dot ledoussal at jymeo dot net Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 7.4.1 OS: MacOS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: gwendal dot ledoussal at jymeo dot net
New email:
PHP Version: OS:


 [2020-01-06 10:13 UTC] gwendal dot ledoussal at jymeo dot net
PHP 7.4 deprecated array and string offset access with curly braces but it also affect property name concatenation.

Test script:

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-01-06 10:20 UTC] bugreports at gmail dot com
$this->{"foo_{$bar}"} = true;
 [2020-01-06 10:21 UTC]
-Status: Open +Status: Not a bug
 [2020-01-06 10:21 UTC]
$this->foo_{$bar} is an array access, as the deprecation warning correctly indicates. It does not concatenate property names.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 23:01:36 2024 UTC