php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71484 Error parsing alias on a block with a reference inside
Submitted: 2016-01-29 15:14 UTC Modified: 2016-06-04 19:19 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: jabi at irontec dot com Assigned: bd808 (profile)
Status: Closed Package: yaml (PECL)
PHP Version: 7.0.2 OS: Debian GNU/Linux 8
Private report: No CVE-ID: None
 [2016-01-29 15:14 UTC] jabi at irontec dot com
Description:
------------
We are getting a segmentation fault parsing some yaml.

Whenever using an alias on a referenced section, the parse breaks.

basic:
  - &external {value: 22 }
keylevel0:
  keylevel1:
    value: 1
  keylevel1.1:
    keylevel2: &strange
      value: 2
      <<: *external

If no alias "&strange" is used, it works fine.
If no reference "<<: *external" is used, it works fine too.


It works as expected on PHP 5.6.12 with yaml-1.2.0.

Test script:
---------------
--TEST--
Test PECL strange alias bug
--SKIPIF--
<?php if(!extension_loaded('yaml')) die('skip yaml n/a'); ?>
--FILE--
<?php

$yaml_code = <<<YAML
basic:
  - &external {value: 22 }
keylevel0:
  keylevel1:
    value: 1
  keylevel1.1:
    keylevel2: &strange
      value: 2
      <<: *external
YAML;
var_dump(yaml_parse($yaml_code));
?>
--EXPECT--
array(2) {
  ["basic"]=>
  array(1) {
    [0]=>
    array(1) {
      ["value"]=>
      int(22)
    }
  }
  ["keylevel0"]=>
  array(2) {
    ["keylevel1"]=>
    array(1) {
      ["value"]=>
      int(1)
    }
    ["keylevel1.1"]=>
    array(1) {
      ["keylevel2"]=>
      array(1) {
        ["value"]=>
        int(2)
      }
    }
  }
}



Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-04 17:49 UTC] bd808@php.net
-Assigned To: +Assigned To: bd808
 [2016-06-04 19:19 UTC] bd808@php.net
-Status: Assigned +Status: Closed
 [2016-06-04 19:19 UTC] bd808@php.net
Fixed in the php7 branch thanks to the PR submitted by jabi
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 09:03:34 2021 UTC