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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
7 + 30 = ?
Subscribe to this entry?

 
 [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

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: Wed Apr 24 22:01:30 2024 UTC