PHP-DYNAMIC-PROP-001

$this->foo = 1 on an untyped class

Dynamic PHP properties (PHP 8.2+)

Joomla 5/6 run on PHP 8.2–8.4. Creating undeclared properties is deprecated and will be removed. Joomla 3 code did this constantly.

$this->foo = 1 on an untyped classDeclare the property or use AllowDynamicProperties

Dies at Joomla 4 → 5J3: Works nativelyJ4: Changed behaviourJ6: Changed behaviourBC plugin: not applicablePatch possible — review itPHP

What you will see

  • Creation of dynamic property
  • Deprecated: Creation of dynamic property

Symptoms people search

php 8.2 deprecation flood · dynamic property

Replace this code

Swap $this->foo = 1 on an untyped class for Declare the property or use AllowDynamicProperties.

Joomla 3

Remove or stop calling this

class LmsHelper {
    public function set($k, $v) { $this->$k = $v; }
}

Joomla 4 / 6

Use this instead

class LmsHelper {
    public string $name;
}
// or #[\AllowDynamicProperties] as a last resort

How to fix it

  1. 1Declare properties on the class.
  2. 2Avoid #[AllowDynamicProperties] except as a temporary bridge.

Also known as

dynamic property · AllowDynamicProperties

Related issues

Get in touch

Have a project in mind? Let's talk about it.

Tell us what you're building. Whether it's a new site, an online store, a mobile app, or something that needs AI under the hood, we'll get back to you within a business day.

Free consultation
No commitment, no pressure
Reply within 24 hours
Usually much faster

Prefer a direct conversation?

Request a project quote

Tell us about your project

Fill out the quick form and we'll reach out.