MODX3 and MIGX 3 shows serveral depcrecated notices in CMP

Hello,

I have several deprecated notices for migx:


Deprecated: Creation of dynamic property modTemplateVarInputRenderMigx::$migx is deprecated in /instdir/core/components/migx/model/migx/migxinputrender.class.php on line 21

Deprecated: Creation of dynamic property Migx::$customconfigs is deprecated in /instdir/core/components/migx/configs/migx_default.config.inc.php on line 9

Deprecated: Creation of dynamic property Migx::$migxlang is deprecated in /instdir/core/components/migx/model/migx/migx.class.php on line 1097

Deprecated: Creation of dynamic property Migx::$langSearch is deprecated in /instdir/core/components/migx/model/migx/migx.class.php on line 1110

Deprecated: Creation of dynamic property Migx::$langReplace is deprecated in /instdir/core/components/migx/model/migx/migx.class.php on line 1111

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /instdir/core/components/migx/model/migx/migx.class.php on line 587

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /instdir/core/components/migx/model/migx/migx.class.php on line 587
[2024-04-25 16:07:48] (ERROR @ /instdir/core/src/Revolution/modX.php : 1709)

[OnDocFormPrerender]

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /instdir/core/src/Revolution/modElement.php on line 729

I use latest MODX 3.0.5 and MIGX 3.0.2-beta1 and PHP 8.2.17

What can I do?

I think it is some updates for MIGX necessary?

Thank you in advance.

bye
Chris

First of all, the code should still run correctly despite the deprecation warnings.

You could change the log level (system setting log_level), so you don’t see the deprecation messages in the MODX error log.

Or you could create a pull request on Github with the necessary code changes to fix the issue.

Eventually the MIGX code has to be adjusted to be fully compatible with PHP 8.2.

In most of the warnings you provided, a “dynamic property” is created which is deprecated in PHP 8.2.
This means that when you have code like this

<?php
class SomeClass
{
    public function doSomething()
    {
        $this->someProperty = 'some value';
    }
}

you have to explicitly add the property “someProperty” to get rid of the warning.

<?php
class SomeClass
{
    public $someProperty; // explicitly add the property that is used later

    public function doSomething()
    {
        $this->someProperty = 'some value';
    }
}
1 Like

You can also change the log_deprecated System Setting.

thanks Bob.

This setting does have no effect. :man_shrugging:

The setting log_deprecated is only for MODX functions that are deprecated.
This won’t work for PHP functionality that is deprecated.

Sorry, you’re correct. I was thinking it changed the PHP error reporting level. Thanks for the correction.