php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60628 mystery circular references after tag callback
Submitted: 2011-12-30 19:43 UTC Modified: 2012-02-26 17:09 UTC
From: alpacagm at gmail dot com Assigned: bd808 (profile)
Status: Closed Package: yaml (PECL)
PHP Version: Irrelevant OS: Linux 2.6.18-194.el5 64
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: alpacagm at gmail dot com
New email:
PHP Version: OS:

 

 [2011-12-30 19:43 UTC] alpacagm at gmail dot com
Description:
------------
Returning composite value (class or array) from tag callback generates circular 
reference on first child item if[!] source value is a composite value 
(see example)

Probably improper work with php variables on extension level. 

Test script:
---------------
<?php
$data=
"#yaml
---
data: !mytag 
  - look upper
...
";

function callback($value){
   return array('data'=>$value,'another'=>'test');
}
$cnt;
$array=yaml_parse($data,0,$cnt,array('!mytag'=>'callback'));

print_r($array['data']);
?>

Expected result:
----------------
Array
(
    [data] => Array
    (
        [0] => look upper
    )
    [another] => test
)

Actual result:
--------------
Array
(
    [data] => Array
 *RECURSION*
    [another] => test
)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-25 06:16 UTC] bd808@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: bd808
 [2012-02-26 17:06 UTC] bd808@php.net
Automatic comment from SVN on behalf of bd808
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=323565
Log: Fixed Bug #60628.
Added current copyright.
Fixed macro collision with php 5.4.0.
Removed php4 cruft.
 [2012-02-26 17:09 UTC] bd808@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

REPLACE_ZVAL_VALUE() was the magic macro I should have been using all along.
 [2012-02-26 17:09 UTC] bd808@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 03:01:28 2025 UTC