| Anonymous | Login | Signup for a new account | 06-09-2026 11:52 PDT |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
| 0004620 | [Quercus] | minor | always | 06-16-11 08:56 | 03-12-13 12:22 | ||||
| Reporter | thr | View Status | public | ||||||
| Assigned To | nam | ||||||||
| Priority | normal | Resolution | unable to reproduce | ||||||
| Status | closed | Product Version | 4.0.14 | ||||||
| Summary | 0004620: Quercus passes 'by value object' as 'reference' | ||||||||
| Description |
Setting up Wordpress 3.1.3 on Quercus after making some quirks to get it run (Issue 0004568 and Issue 0004612) I get it working. Only if I signed in as admin and Under the menu Item where all articels are listed, I found a difference to a 'normal' php wordpress installation. All the links below the artikel list, which will allow you to edit, delete, etc, the articels, all my links where gone, like I do not have permission to edit. Investigating the problem I found that Wordpress is using a function called 'wp_list_pluck' to reduce a big array of article-type definitions to a single value. Thru some calls Wordpress passed the object $wp_post_types to this function. This function then returns one field out of this object. As this list is assigning a new value to one of the function parameters and returning it to the callee, I found after thre calls the original $wp_post_types was modfied/damaged. As php is passing the object by value, this should not be possible. Under some circumstances Quercus seems to pass this object as reference. To fix this, I changed the funtion in Wordpress to use a new variable to return the result instead of the function parameter. Unfortunately I could not simulate the behaviour in a simple test script. But anyway I might want to have a look to understand the principle problem ... but there must be happening more in wordpress to cause this ..... |
||||||||
| Additional Information |
/** * Pluck a certain field out of each object in a list * * @since 3.1.0 * * @param array $list A list of objects or arrays * @param int|string $field A field from the object to place instead of the entire object * @return array */ function wp_list_pluck( $list, $field ) { foreach ( $list as $key => $value ) { $value = (array) $value; $list[ $key ] = $value[ $field ]; } return $list; } CHANEGED To: function wp_list_pluck( $list, $field ) { foreach ( $list as $key => $value ) { $value = (array) $value; $new_list[ $key ] = $value[ $field ]; } return $new_list; } |
||||||||
| Attached Files |
|
||||||||
|
|
|||||||||
| Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
35 total queries executed. 29 unique queries executed. |