SemanticMediaWiki / SemanticExtraSpecialProperties

Provides extra special properties to Semantic MediaWiki.
https://www.mediawiki.org/wiki/Extension:Semantic_Extra_Special_Properties
Other
25 stars 25 forks source link

Creation of dynamic property is deprecated #228

Open krabina opened 1 month ago

krabina commented 1 month ago

Setup and configuration

Issue

Using php 8.2. shows a lot of deprecation warnings (also happening in PHP 8.1)

2024/06/14 07:04:22 [error] 18561#18561: *69922 FastCGI sent in stderr: "PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property SESP\PropertyDefinitions::$cfg is deprecated in /extensions/SemanticExtraSpecialProperties/src/PropertyDefinitions.php on line 58; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243" while reading response header from upstream, client: 10.106.223.30, server: , request: "GET /Rosenbaumgarten HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm-wiki.sock:", host: "www."
2024/06/14 07:04:23 [error] 18561#18561: *69922 FastCGI sent in stderr: "PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property SESP\PropertyDefinitions::$cfg is deprecated in /extensions/SemanticExtraSpecialProperties/src/PropertyDefinitions.php on line 58; PHP message: PHP Deprecated:  Creation of dynamic property Title::$smwLikelyOutdatedDependencies is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243" while reading response header from upstream, client: 10.106.223.30, server: , request: "GET /Danhausergasse HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm-wiki.sock:", host: "www."
2024/06/14 07:04:23 [error] 18562#18562: *71118 FastCGI sent in stderr: "PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property SESP\PropertyDefinitions::$cfg is deprecated in /extensions/SemanticExtraSpecialProperties/src/PropertyDefinitions.php on line 58; PHP message: PHP Deprecated:  Creation of dynamic property Title::$smwLikelyOutdatedDependencies is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243" while reading response header from upstream, client: 10.106.223.30, server: , request: "GET /Rosstummelplatz HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm-wiki.sock:", host: "www."
2024/06/14 07:04:23 [error] 18561#18561: *70464 FastCGI sent in stderr: "PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property SESP\PropertyDefinitions::$cfg is deprecated in /extensions/SemanticExtraSpecialProperties/src/PropertyDefinitions.php on line 58; PHP message: PHP Deprecated:  Creation of dynamic property Title::$smwLikelyOutdatedDependencies is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243" while reading response header from upstream, client: 10.106.223.30, server: , request: "GET /Buchhandlung_Richard_L%C3%A1nyi HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm-wiki.sock:", host: "www."
2024/06/14 07:04:24 [error] 18561#18561: *70464 FastCGI sent in stderr: "PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property SESP\PropertyDefinitions::$cfg is deprecated in /extensions/SemanticExtraSpecialProperties/src/PropertyDefinitions.php on line 58; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243" while reading response header from upstream, client: 10.106.223.30, server: , request: "GET /Rote_Garde HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm-wiki.sock:", host: "www."
2024/06/14 07:04:25 [error] 18561#18561: *70464 FastCGI sent in stderr: "PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property SESP\PropertyDefinitions::$cfg is deprecated in /extensions/SemanticExtraSpecialProperties/src/PropertyDefinitions.php on line 58; PHP message: PHP Deprecated:  Creation of dynamic property Title::$smwLikelyOutdatedDependencies is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243" while reading response header from upstream, client: 10.106.223.30, server: , request: "GET /Bratislava HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm-wiki.sock:", host: "www."
2024/06/14 07:04:25 [error] 18562#18562: *71118 FastCGI sent in stderr: "PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property SESP\PropertyDefinitions::$cfg is deprecated in /extensions/SemanticExtraSpecialProperties/src/PropertyDefinitions.php on line 58; PHP message: PHP Deprecated:  Creation of dynamic property Title::$smwLikelyOutdatedDependencies is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243; PHP message: PHP Deprecated:  Creation of dynamic property Title::$isApprovable is deprecated in /includes/debug/DeprecationHelper.php on line 243" while reading response header from upstream, client: 10.106.223.30, server: , request: "GET /Adresse:Rieglgasse_87-89(HAUS_9) HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm-wiki.sock:", host: "www."
2024/06/14 07:04:25 [error] 18561#18561: *70770 FastCGI sent in stderr: "PHP message: PHP Deprecated:  Creation of dynamic property SESP\PropertyDefinitions::$cfg is deprecated in /extensions/SemanticExtraSpecialProperties/src/PropertyDefinitions.php on line 58; PHP message: PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /extensions/PageForms/includes/PF_TemplateField.php on line 186; PHP message: PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /extensions/PageForms/includes/PF_TemplateField.php on line 186; PHP message: PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /extensions/PageForms/includes/PF_TemplateField.php on line 186; PHP message: PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /extensions/PageForms/includes/PF_TemplateField.php on line 186; PHP message: PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /extensions/PageForms/includes/PF_TemplateField.php on line 186; PHP message: PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /extensions/PageForms/includes/PF_TemplateField.php on line 186; PHP message: PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /extensions/PageForms/includes/PF_TemplateField.php on line 186; PHP message: PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /extensions/PageForms/includes/PF_TemplateField.php on line 186; PHP message: PHP Deprecated:  trim(): Passing null to parameter #1 ($stri

https://github.com/SemanticMediaWiki/SemanticExtraSpecialProperties/blob/61660bab6dc8888ce7781f366cec9374786b6fa0/src/PropertyDefinitions.php#L58

https://stackoverflow.com/questions/74991682/php-8-2-dynamic-properties-deprecated-how-to-use-them-anyway-in-a-compatible-wa

alex-mashin commented 1 month ago

It's upstream. Should be reported there: https://phabricator.wikimedia.org/tag/php_8.2_support/. Don't know if they will patch MediaWiki 1.39 for compatibility with PHP 8.2.

krabina commented 1 month ago

But it also happens in PHP 8.1

krabina commented 1 month ago

No, correction. It only happens in 8.2. In 8.1 only this one is shown: Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /vendor/easyrdf/easyrdf/lib/Http/Response.php on line 170

thomas-topway-it commented 1 month ago

the smw errors could be solved from here

        if (
            $postEdit === null &&
            $pagePurge &&
            DependencyValidator::hasLikelyOutdatedDependencies( $title ) ) {
            // Only push a purge when it is known that it not a postEdit action
            // to avoid recursive purges
            $attributes['data-title'] = $title->getPrefixedDBKey();
            $attributes['data-msg'] = 'smw-purge-update-dependencies';
            $attributes['data-forcelinkupdate'] = true;
            return Html::rawElement( 'div', [ 'class' => 'smw-postproc page-purge' ] + $attributes );
        } elseif (
            $postEdit === null &&
            DependencyValidator::hasLikelyOutdatedDependencies( $title ) ) {
            // We still suspect outdated query dependencies but only
            // force an update of the parserCache without a purge since
            // we don't have any `@annotation` queries that would require
            // to recompute any pending annotations
            $parameters = [
                'action' => 'post-processing-query-dependency'
            ];

            $parserCachePurgeJob = new ParserCachePurgeJob( $title, $parameters );
            $parserCachePurgeJob->updateParserCache();
        }

(src/PostProcHandler.php) (passing $this->parserOutput inside DependencyValidator::hasLikelyOutdatedDependencies instead of $title)

and using $this->parserOutput->setExtensionData or setProperty (inside markTitle) (unless there is a good reason to not use them)

also considering this comment

    /**
     * Signal to the `OutputPageParserOutput` hook to we want a possible purge
     * action.
     *
     * @since 3.1
     *
     * @param Title $title
     */
    public function markTitle( Title $title ) {
        $title->smwLikelyOutdatedDependencies = true;
    }

(src/DependencyValidator.php)

thomas-topway-it commented 1 month ago

regarding $title->isApprovable I couldn't find where it comes from