PHP :: Bug #76309 :: Unexpected handling of strings that consist of numbers followed by a period
php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76309 Unexpected handling of strings that consist of numbers followed by a period
Submitted: 2018-05-07 16:00 UTC Modified: -
From: niklas dot laxstrom at gmail dot com Assigned:
Status: Open Package: yaml (PECL)
PHP Version: 7.1.17 OS: Debian
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-05-07 16:00 UTC] niklas dot laxstrom at gmail dot com
Description:
------------
Strings matching pattern [0-9]+\. are emitted without quotes, which according to YAML 1.2 spec http://yaml.org/spec/1.2/spec.html#id2805071 are floats. They should be quoted as strings.

I could not find a clear answer from YAML 1.1 spec (what the extensions claims to support) what is the expected behavior there.

Test script:
---------------
echo yaml_emit( [ 'a' => '1.0', 'b' => '2.', 'c' => '3'] );

Expected result:
----------------
---
a: "1.0"
b: "2."
c: "3"
...

Actual result:
--------------
---
a: "1.0"
b: 2.
c: "3"
...


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Tue Aug 14 08:01:25 2018 UTC