Page MenuHomePhabricator

PHP setting serialize_precision may influence unit tests when serialize() is used.
Closed, ResolvedPublic

Description

Example failure from https://lists.wikimedia.org/pipermail/wikitech-l/2015-October/083675.html:

1) ApiFormatPhpTest::testGeneralEncoding with data set #7 (array(1.0E+42), 'a:1:{i:0;d:1.0E+42;}', array(1))
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-a:1:{i:0;d:1.0E+42;}
+a:1:{i:0;d:1000000000000000044885712678075916785549312;}

/usr/home/saper/public_html/ybabel/tests/phpunit/includes/api/format/ApiFormatTestBase.php:61
/usr/home/saper/public_html/ybabel/tests/phpunit/MediaWikiTestCase.php:137

2) ApiFormatPhpTest::testGeneralEncoding with data set #30 (array(1.0E+42), 'a:1:{i:0;d:1.0E+42;}', array(2))
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-a:1:{i:0;d:1.0E+42;}
+a:1:{i:0;d:1000000000000000044885712678075916785549312;}

/usr/home/saper/public_html/ybabel/tests/phpunit/includes/api/format/ApiFormatTestBase.php:61
/usr/home/saper/public_html/ybabel/tests/phpunit/MediaWikiTestCase.php:137

The cause was running PHP with serialize_precision set to 100.

Event Timeline

saper raised the priority of this task from to Low.
saper updated the task description. (Show Details)
saper added a project: MediaWiki-Core-Tests.
saper subscribed.

Change 249018 had a related patch set uploaded (by saper):
Reset serialize_precision to stabilize tests

https://gerrit.wikimedia.org/r/249018

Change 249018 merged by jenkins-bot:
Reset serialize_precision to stabilize tests

https://gerrit.wikimedia.org/r/249018

Anomie assigned this task to saper.

Change 249183 had a related patch set uploaded (by saper):
set serialize_precision to 17, current PHP default

https://gerrit.wikimedia.org/r/249183

Change 249183 merged by jenkins-bot:
set serialize_precision to 17, current PHP default

https://gerrit.wikimedia.org/r/249183

daniel added subscribers: Aleksey_WMDE, daniel.

It seems that hhvm ignores this setting. @Aleksey_WMDE investigated a related issue for Wikidata (T161231), ask him for details.