ms609 / citation-bot

Citation bot is a tool to expand and format references at Wikipedia. It retrieves citation data from a variety of sources including CrossRef (DOI), PMID, PMC and JSTOR, and returns a formatted citation. Report bugs at https://en.wikipedia.org/wiki/User_talk:Citation_bot
https://en.wikipedia.org/wiki/User:Citation_bot/use
GNU General Public License v3.0
54 stars 23 forks source link

PHP Deprecated: Creation of dynamic property MediaWiki\OAuthClient\Request::$base_string is deprecated in HmacSha1.php #4406

Closed maximmasiutin closed 9 months ago

maximmasiutin commented 9 months ago

I'm using oauthclient library version 2.0.0 as prescribed in the readme (composer require mediawiki/oauthclient:2.0.0) and php 8.3.2. With these settings, whenever bot writes a page, I'm getting the following php deprecaded messages, see example output of php process_page.php "Xerces blue" --slow:

>Writing to Xerces blue... 

PHP Deprecated:  Creation of dynamic property MediaWiki\OAuthClient\Request::$base_string is deprecated in citation-bot/vendor/mediawiki/oauthclient/src/SignatureMethod/HmacSha1.php on line 65

Deprecated: Creation of dynamic property MediaWiki\OAuthClient\Request::$base_string is deprecated in citation-bot/vendor/mediawiki/oauthclient/src/SignatureMethod/HmacSha1.php on line 65

PHP Deprecated:  Creation of dynamic property MediaWiki\OAuthClient\Request::$base_string is deprecated in citation-bot/vendor/mediawiki/oauthclint/src/SignatureMethod/HmacSha1.php on line 65

Deprecated: Creation of dynamic property MediaWiki\OAuthClient\Request::$base_string is deprecated in citation-bot/vendor/mediawiki/oauthclient/src/SignatureMethod/HmacSha1.php on line 65

https://en.wikipedia.org/w/index.php?title=Xerces+blue&diff=prev&oldid=120447238                                               7

This message can also be seen in the github runner, e.g. see [https://github.com/ms609/citation-bot/actions/runs/7807608076/job/21296304922?pr=4405]. You will be able to find the following lines there:

PHP Deprecated:  Creation of dynamic property MediaWiki\OAuthClient\Request::$base_string is deprecated in /home/runner/work/citation-bot/citation-bot/vendor/mediawiki/oauthclient/src/SignatureMethod/HmacSha1.php

Maybe we should switch to latest version of the MediaWiki OAuthClient where this "deprecated" code is not used.

GlazerMann commented 9 months ago

They have not fixed it yet. I have complained a while back. Also, 2.0.0 is the "latest version" with a number. If we change to the actual latests version, what we get will keep changing. https://phabricator.wikimedia.org/T352814

maximmasiutin commented 9 months ago

Maybe we could fix that and submit a pull request? Do you have any idea on how to fix that?

GlazerMann commented 9 months ago

You have to submit pull requests this way: https://github.com/wikimedia/mediawiki-oauthclient-php/pull/10

GlazerMann commented 9 months ago

The solution is to add this to Client.php: /**

Add to add this to Request.php /**

I personally would remove the setting of variables, but I assume they exist for some reason.

maximmasiutin commented 9 months ago

Probably this "$base_string" is not used at all, at least in our citation bot. It may be used in other programs though. I would have removed it at all. But probably safer will be to define it as you recommend.

maximmasiutin commented 9 months ago

I saw you submitted the pull request via GitHub, but they asked to submit to Gerrit.

I submitted via Gerrit as https://gerrit.wikimedia.org/r/c/mediawiki/oauthclient-php/+/999133

I will close this issue because it is related to oauthclient.