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

Hard-coded error_reporting breaks API on PHP 8.1 #33

Open
kwisatz opened this issue Aug 9, 2022 · 0 comments
Open

Hard-coded error_reporting breaks API on PHP 8.1 #33

kwisatz opened this issue Aug 9, 2022 · 0 comments

Comments

@kwisatz
Copy link

kwisatz commented Aug 9, 2022

Wondering why error_reporting is hardcoded in api.php?

error_reporting(E_ERROR|E_CORE_ERROR|E_ALL|E_COMPILE_ERROR); // 
ini_set('display_errors', 'On');

I spent quite some time wondering why my settings in php.ini weren't working to finally figure out they were overwritten.

Trouble is, your composer.json does not fix a PHP version, e.g. 7.4 and so we end up with dependencies that require 8.1 in some situations (Think docker multi-stage builds…).

With 8.1 and the level of error_reporting hard-coded in api.php, the result on an API call is:

<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>1096</b><br />
{"status":"OK","command":{"action":"create","type":"item","data":{"claims":[{"mainsnak":{"snaktype":"value","property":"P1","datavalue":{"type":"wikibase-entityid","value":{"entity-type":"item","id":"Q17"}}},"type":"statement","rank":"normal"},{"mainsnak":{"snaktype":"value","property":"P18","datavalue":{"type":"string","value":"I made a second attempt of a QS"}},"type":"statement","rank":"normal"}]},"meta":{"message":"","status":"RUN","id":0},"summary":"#temporary_batch_1660059860160","status":"done","run":{"action":"wbeditentity","new":"item","data":"{\"claims\":[{\"mainsnak\":{\"snaktype\":\"value\",\"property\":\"P1\",\"datavalue\":{\"type\":\"wikibase-entityid\",\"value\":{\"entity-type\":\"item\",\"id\":\"Q17\"}}},\"type\":\"statement\",\"rank\":\"normal\"},{\"mainsnak\":{\"snaktype\":\"value\",\"property\":\"P18\",\"datavalue\":{\"type\":\"string\",\"value\":\"I made a second attempt of a QS\"}},\"type\":\"statement\",\"rank\":\"normal\"}]}","summary":"#quickstatements; #temporary_batch_1660059860160","bot":1,"token":"************************+\\","format":"json"},"item":"Q1162"},"last_item":"Q1162"}
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

1 participant