|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66607 Some tag keys are converted to integers
Submitted: 2014-01-29 23:24 UTC Modified: 2014-01-31 05:29 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: shoghicp at pocketmine dot net Assigned:
Status: Not a bug Package: yaml (PECL)
PHP Version: 5.5.8 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: shoghicp at pocketmine dot net
New email:
PHP Version: OS:


 [2014-01-29 23:24 UTC] shoghicp at pocketmine dot net
Several tag keys are converted to an integer value (0 or 1) when the key can be interpreted as a boolean (like y, yes, true, off, no). This only happens when the tag is not quoted.

Test script:
$yaml = <<<YAML
  x: 147
  y: 85
  z: 176

Expected result:
array(2) {
  array(3) {

Actual result:
array(2) {
  array(3) {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-31 05:29 UTC]
-Status: Open +Status: Not a bug
 [2014-01-31 05:29 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

I believe that this is actually the correct behavior according to the YAML 1.1 spec. Keys in a YAML mapping can be any type and the unquoted scalar strings listed at are treated as booleans. The mapping you give in your example is equivalent to `array( "x" => 147, true => 85, "z" => 176 )` which var_dump() describes in the same way as your actual result.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 24 06:03:33 2021 UTC