Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated message in SMW 4.1.2 #5542

Open
pav00 opened this issue Oct 12, 2023 · 7 comments
Open

Deprecated message in SMW 4.1.2 #5542

pav00 opened this issue Oct 12, 2023 · 7 comments

Comments

@pav00
Copy link

pav00 commented Oct 12, 2023

Configuration:
MediaWiki | 1.39.4
PHP | 8.1.23 (fpm-fcgi)
MariaDB | 11.1.2-MariaDB
ICU | 73.2
LilyPond | 2.22.2
Elasticsearch | 7.10.2

Discovered messages so far:

  • Deprecated: str_replace(): Passing null to parameter #2($replace) of type array|string is deprecated in .../SemanticMediaWiki/src/Utils/TemplateEngine.php on line 120 appeared after install of SMW 4.1.2.

  • Deprecated: SMW\MediaWiki\Content\SchemaContent overrides fillParserOutput which was deprecated in MediaWiki 1.38. [Called from MediaWiki\Content\Renderer\ContentRenderer::getParserOutput in .../includes/content/Renderer/ContentRenderer.php at line 47] in .../includes/debug/MWDebug.php on line 381

  • Deprecated: Use of AbstractContent::getParserOutput was deprecated in MediaWiki 1.38. [Called from ContentHandler::callDeprecatedContentGPO in .../includes/content/ContentHandler.php at line 1883] in .../includes/debug/MWDebug.php on line 381

  • PHP Deprecated: Implicit conversion from float 34.5 to int loses precision in .../SemanticMediaWiki/src/Utils/CliMsgFormatter.php on line 425

@krabina
Copy link
Contributor

krabina commented Oct 12, 2023

see also #5539

@qwertychouskie
Copy link

This affects https://repair.wiki/w/Repair_Wiki

@softmare
Copy link

softmare commented Nov 28, 2023

For someone who want to fix str_replace message oneself, adding if condition on line 120 works for me.

                foreach ( $args as $key => $value ) {
# add from here
                        if ( $value == null) {
                                $value = '';
                        }
# to here
                        $complied = str_replace( [ '{{' . $key . '}}', '{{#' . $key . '}}' ], $value, $complied );
                }

@Nikerabbit
Copy link
Contributor

In a modern php that can be written as $value ?? '' and loose comparisons should be avoided because it will mishandle 0 for example.

Also, it's better to report one warning per issue.

@krabina
Copy link
Contributor

krabina commented Jan 22, 2024

For me the first one (Passing null to parameter) happens when running updateEntityCollation.php

MW 1.39.6, SMW 4.1.2

PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Blob.php on line 26
PHP Stack trace:
PHP   1. {main}() /extensions/SemanticMediaWiki/maintenance/updateEntityCollation.php:0
PHP   2. require_once() /extensions/SemanticMediaWiki/maintenance/updateEntityCollation.php:302
PHP   3. MediaWiki\Maintenance\MaintenanceRunner->run() /maintenance/doMaintenance.php:85
PHP   4. SMW\Maintenance\updateEntityCollation->execute() /maintenance/includes/MaintenanceRunner.php:309
PHP   5. SMW\Maintenance\updateEntityCollation->runUpdate($rows = class Wikimedia\Rdbms\MysqliResultWrapper { protected $nextPos = 1; protected $currentPos = 0; protected $currentRow = class stdClass { public $smw_id = '1'; public $smw_title = '_TYPE'; public $smw_sortkey = ' TYPE' }; private ${Wikimedia\Rdbms\ResultWrapper}fieldNames = NULL; private $db = class Wikimedia\Rdbms\DatabaseMysqli { protected $srvCache = class HashBagOStuff { ... }; protected $csProvider = class Wikimedia\RequestTimeout\CriticalSectionProvider { ... }; protected $connLogger = class MediaWiki\Logger\LegacyLogger { ... }; protected $queryLogger = class MediaWiki\Logger\LegacyLogger { ... }; protected $replLogger = class MediaWiki\Logger\LegacyLogger { ... }; protected $errorLogger = [...]; protected $deprecationLogger = [...]; protected $profiler = class Closure { virtual $closure = "MWLBFactory::{closure}", ... }; private ${Wikimedia\Rdbms\Database}transactionManager = class Wikimedia\Rdbms\TransactionManager { ... }; protected $currentDomain = class Wikimedia\Rdbms\DatabaseDomain { ... }; protected $conn = class mysqli { ... }; protected $topologicalPrimaryConnRef = class Wikimedia\Rdbms\DBConnRef { ... }; protected $server = NULL; protected $user = NULL; protected $password = NULL; protected $serverName = NULL; protected $cliMode = TRUE; protected $agent = ''; protected $topologyRole = 'streaming-master'; protected $connectionParams = [...]; protected $connectionVariables = [...]; protected $nonNativeInsertSelectBatchSize = 10000; protected $flags = 17; protected $ssl = FALSE; protected $lbInfo = [...]; protected $delimiter = ';'; private ${Wikimedia\Rdbms\Database}htmlErrors = '0'; private ${Wikimedia\Rdbms\Database}priorFlags = [...]; protected $sessionNamedLocks = [...]; protected $sessionTempTables = [...]; private ${Wikimedia\Rdbms\Database}trxReplicaLagSta

@jaideraf
Copy link
Member

jaideraf commented Jan 22, 2024

For me the first one (Passing null to parameter) happens when running updateEntityCollation.php

I think this one was fixed here #5528

@krabina
Copy link
Contributor

krabina commented Jan 22, 2024

True, moving from 4.1.2 to latest master, the warning goes away

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@Nikerabbit @jaideraf @krabina @qwertychouskie @pav00 @softmare and others