Características obsoletas

Núcleo PHP

Uso de las propiedades dinámicas

La creación de propiedades dinámicas está obsoleta, a menos que la clase opte por utilizar el atributo #[\AllowDynamicProperties]. La clase stdClass permite propiedades dinámicas. El uso de los métodos mágicos como __get()/__set() no se ven afectados por este cambio. Un aviso de obsolescencia de uso de propiedades dinámicas puede ser abordado por:

  • Declaring the property (preferred).
  • Adding the #[\AllowDynamicProperties] attribute to the class (which also applies to all child classes).
  • Using a WeakMap if additional data needs to be associated with an object which one does not own.

Relative callables

Callables that are not accepted by the $callable() syntax (but are accepted by call_user_func()) are deprecated. In particular:

  • "self::method"
  • "parent::method"
  • "static::method"
  • ["self", "method"]
  • ["parent", "method"]
  • ["static", "method"]
  • ["Foo", "Bar::method"]
  • [new Foo, "Bar::method"]
This does not affect normal method callables such as "A::method" or ["A", "method"].

"${var}" and "${expr}" style interpolation

The "${var}" and "${expr}" style of string interpolation is deprecated. Use "$var"/"{$var}" and "{${expr}}", respectively.


Usage of the QPrint, Base64, Uuencode, and HTML-ENTITIES 'text encodings' is deprecated for all MBString functions. Unlike all the other text encodings supported by MBString, these do not encode a sequence of Unicode codepoints, but rather a sequence of raw bytes. It is not clear what the correct return values for most MBString functions should be when one of these non-encodings is specified. Moreover, PHP has separate, built-in implementations of all of them; for example, UUencoded data can be handled using convert_uuencode()/convert_uudecode().


The internal SplFileInfo::_bad_state_ex() method has been deprecated.


utf8_encode() and utf8_decode() have been deprecated.

add a note

User Contributed Notes 1 note

tabflo at gmx dot at
10 months ago
a have a baseclass for all databasemodels and handle my dynamic property setter and getter this way:

public array $dynamicProperties = [];

public function __set(string $name, mixed $value) {
if(property_exists($this, $name))
$this->{$name} = $value;
$this->dynamicProperties[$name] = $value;

public function __get(string $name) {
if(property_exists($this, $name))
return $this->$name;
return $this->dynamicProperties[$name];

just put the content into a class and extend from it. enjoy :)
To Top