Problem/Motivation

PECL's yaml module can incorrectly parse floating point values in yaml files when running on Alpine.

Proposed resolution

Resolve upstream: https://bugs.php.net/bug.php?id=75213

Remaining tasks

User interface changes

API changes

Data model changes

Original Report:

I am getting a testing failure from the Serialization Component when running PHPUnit tests.

Environment:

PHP: 7.1.5
OS: Linux - Alpine v3.4.6
Drupal: 8.3.2

Yaml extension installed via:

pecl install yaml-2.0.0

Running tests:

cd core
../vendor/bin/phpunit --testsuite=unit  -v

Results in:

There was 1 failure:

1) Drupal\Tests\Component\Serialization\YamlTest::testYamlFiles with data set #178 ('/home/app/src/docroot/core/mo...es.yml')
/home/app/src/docroot/core/modules/config/tests/config_test/config/install/config_test.types.yml
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     'array' => Array ()
     'boolean' => true
-    'exp' => 1.2E+34
-    'float' => 3.14159
+    'exp' => 1.2000000000000467E+34
+    'float' => 3.1415900000001784
     'float_as_integer' => 1.0
     'hex' => 12
     'int' => 99
     'octal' => 509
     'string' => 'string'
     'string_int' => '1'
 )

/home/app/src/docroot/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php:71

Looks like an error relating to precision.

This could potentially be an issue with the compiled yaml and yaml-dev packages used when compiling the Yaml PHP extension. I will verify against a different operation system (Debian).

Any one else hitting this failure?

Comments

ellioseven created an issue. See original summary.

ellioseven’s picture

ellioseven’s picture

Issue summary: View changes
ellioseven’s picture

Issue summary: View changes
wim leers’s picture

Version: 8.3.2 » 8.3.x-dev
Component: serialization.module » base system

This is not in the serialization module, but in the component, which is a very different kind of serialization.

(Yes, this is confusing :/)

wim leers’s picture

wim leers’s picture

Title: Serialization\YamlTest test failure » Serialization\YamlTest test failure after doing `pecl install yaml-2.0.0`
Assigned: Unassigned » neclimdul

neclimdul spearheaded the PECL YAML support. Assigning to him.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

henk’s picture

I have same problem, when I run unit tests from PHP 7.0 or PHP 7.1.

neclimdul’s picture

Yeah I've seen that too. Have you tested it against Debian? Curious if it's musl related.

neclimdul’s picture

Issue summary: View changes
Status: Active » Postponed

Confirmed it works fine in the default docker debian image so this isn't just magically passing on d.o there seems to be a bug in pecl's yaml module when built on alpine. Reported upstream with simplified test scripts: https://bugs.php.net/bug.php?id=75213

We don't really have a "tracking upstream" status as far as I know so marking this postponed since there isn't anything for Drupal to do ATM.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

neclimdul’s picture

Fix was merged upstream yesterday and hopefully we'll get a release soon with the fix.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

wiifm’s picture

Status: Postponed » Fixed

According to https://bugs.php.net/bug.php?id=75213, the fix was released in Yaml 2.0.3. The latest version today is 2.1.0. I think this issue can be closed (unless we can set Drupal's minimum requirements for the Yaml PECL library).

neclimdul’s picture

Definitely fixed and I'm not sure its worth the requirements at this point. :-D Thanks for following up and closing this, I had no idea the issue was still open.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.