php.net |  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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
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
  } 
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] nikic@php.net
-Status: Open +Status: Not a bug
 [2020-01-06 10:21 UTC] nikic@php.net
$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: Fri Apr 19 23:01:28 2024 UTC