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.

Details

Related Gerrit Patches:

Event Timeline

saper created this task.Oct 26 2015, 10:42 PM
saper raised the priority of this task from to Low.
saper updated the task description. (Show Details)
saper added a project: MediaWiki-Core-Testing.
saper added a subscriber: saper.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 26 2015, 10:42 PM
saper set Security to None.

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 closed this task as Resolved.Oct 27 2015, 1:22 PM
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.