Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004929 [Quercus] major always 01-24-12 06:39 06-21-12 01:23
Reporter jgilje View Status public  
Assigned To nam
Priority normal Resolution unable to reproduce  
Status closed   Product Version 4.0.14
Summary 0004929: Array is passed as reference, even though function is defined as pass-by-value
Description Using the latest version of wordpress, I had trouble using the page-editor. On wp-admin/edit.php?post_type=page no edit links appear. I narrowed the bug down to the global variable $wp_post_types getting corrupted by the callstack starting at

wp-admin/includes/post.php - line 852 - call to get_post_types();
wp-includes/post.php - line 854 - call to wp_filter_object_list();
wp-includes/functions.php - 3228 - call to wp_list_pluck();
wp-includes/functions.php - 3286 - definition of wp_list_pluck();

After the call to wp_list_pluck(), $wp_post_types is corrupted. However, if changing the function wp_list_pluck() to create a copy of its $list parameter as follows

function wp_list_pluck( $list, $field ) {
    $ret = array();
    foreach ( $list as $key => $value ) {
        if ( is_object( $value ) )
            $ret[ $key ] = $value->$field;
        else
            $ret[ $key ] = $value[ $field ];
    }

    return $ret;
}

it works perfectly. To me, this seems as the $list variable passed to wp_list_pluck() is assigned by reference and not by value through the callstack coming from get_post_types() in wp-includes/post.php - even though the functions involved does not specify pass-by-reference.
Additional Information
Attached Files  diff.txt [^] (569 bytes) 01-24-12 06:39

- Relationships

- Notes
(0005918)
nam
06-21-12 01:23

Unable to reproduce on 4.0.29. Tested wordpress-3.3.1. I am seeing edit links for the edit.php page.
 

- Issue History
Date Modified Username Field Change
01-24-12 06:39 jgilje New Issue
01-24-12 06:39 jgilje File Added: diff.txt
06-21-12 01:22 nam Status new => assigned
06-21-12 01:22 nam Assigned To  => nam
06-21-12 01:23 nam Status assigned => closed
06-21-12 01:23 nam Note Added: 0005918
06-21-12 01:23 nam Resolution open => unable to reproduce


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
30 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker