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: 2018-11-13 03:03 UTC
From: niklas dot laxstrom at gmail dot com Assigned: bd808 (profile)
Status: Closed Package: yaml (PECL)
PHP Version: 7.1.17 OS: Debian
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: niklas dot laxstrom at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-13 01:22 UTC] bd808@php.net
-Assigned To: +Assigned To: bd808
 [2018-11-13 03:03 UTC] bd808@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 00:01:32 2024 UTC