@@ -517,17 +517,29 @@ public function testEmptySerializationStability() {
517517 $ this ->assertSame ( 'a:0:{} ' , $ list ->serialize () );
518518 }
519519
520+ /**
521+ * This test will change when the serialization format changes.
522+ * If it is being changed intentionally, the test should be updated.
523+ * It is just here to catch unintentional changes.
524+ */
520525 public function testSerializationStability () {
521526 $ list = new ReferenceList ();
522527 $ list ->addNewReference ( new PropertyNoValueSnak ( 1 ) );
523528
524- $ testString = "a:1:{i:0;O:28: \"Wikibase \\DataModel \\Reference \":1:{s:35: \"\x00Wikibase \\DataModel \\"
525- . "Reference \x00snaks \";C:32: \"Wikibase \\DataModel \\Snak \\SnakList \":100:{a:2:{s:4: \""
526- . 'data";a:1:{i:0;C:43:"Wikibase \\DataModel \\Snak \\PropertyNoValueSnak":2:{P1}}s:5 '
527- . ':"index";i:0;}}}} ' ;
528-
529- $ secondList = new ReferenceList ();
530- $ secondList ->unserialize ( $ testString );
529+ /*
530+ * https://wiki.php.net/rfc/custom_object_serialization
531+ */
532+ if ( version_compare ( phpversion (), '7.4 ' , '>= ' ) ) {
533+ $ testString = "a:1:{i:0;O:28: \"Wikibase \\DataModel \\Reference \":1:{s:35: \"\x00Wikibase \\DataModel \\"
534+ . "Reference \x00snaks \";O:32: \"Wikibase \\DataModel \\Snak \\SnakList \":2:{s:4: \""
535+ . 'data";a:1:{i:0;C:43:"Wikibase \\DataModel \\Snak \\PropertyNoValueSnak":2:{P1}}s:5 '
536+ . ':"index";i:0;}}} ' ;
537+ } else {
538+ $ testString = "a:1:{i:0;O:28: \"Wikibase \\DataModel \\Reference \":1:{s:35: \"\x00Wikibase \\DataModel \\"
539+ . "Reference \x00snaks \";C:32: \"Wikibase \\DataModel \\Snak \\SnakList \":100:{a:2:{s:4: \""
540+ . 'data";a:1:{i:0;C:43:"Wikibase \\DataModel \\Snak \\PropertyNoValueSnak":2:{P1}}s:5 '
541+ . ':"index";i:0;}}}} ' ;
542+ }
531543
532544 $ this ->assertSame (
533545 $ testString ,
0 commit comments