Skip to content

fix: Deprecation warning & float to int conversion#58

Merged
magnusmanske merged 1 commit intomagnusmanske:masterfrom
deer-wmde:fix-sleep-int-conversion
Jan 31, 2025
Merged

fix: Deprecation warning & float to int conversion#58
magnusmanske merged 1 commit intomagnusmanske:masterfrom
deer-wmde:fix-sleep-int-conversion

Conversation

@deer-wmde
Copy link
Contributor

With PHP 8.1, I got this output when running a batch:

<br />
<b>Deprecated</b>:  Implicit conversion from float 0.1 to int loses precision in <b>/var/www/html/quickstatements/public_html/quickstatements.php</b> on line <b>1137</b><br />
{"status":"OK","command":{"action":"add","item":"Q2","property":"P1","what":"statement","datavalue":{"type":"wikibase-entityid","value":{"entity-type":"item","id":"Q1"}},"meta":{"message":"","status":"RUN","id":0},"summary":"#temporary_batch_1738321266983","status":"done","message":"Statement already exists as Q2$5A1CDA8E-2620-4665-ADEF-405FAED776A2"},"last_item":""}

Which made the UI fail to parse the response.

Thus I looked at the usage of $this->sleep and found only this one instance, where it seemed safe to just multiply to microseconds and use usleep instead.

tarrow added a commit to wbstack/quickstatements that referenced this pull request Jan 31, 2025
We saw one case of errors appearing in JSON responses
breaking their parsing[1]. This commit should disable
displaying (in the response) but not disable all
reporting[2].

[1] magnusmanske/quickstatements#58
[2] https://stackoverflow.com/a/21699794
@magnusmanske magnusmanske merged commit 22e76ba into magnusmanske:master Jan 31, 2025
@deer-wmde deer-wmde mentioned this pull request Feb 11, 2025
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

Successfully merging this pull request may close these issues.

2 participants