Skip to content

Commit

Permalink
MDL-35001 removed cycle detection from convert_to_array because it ca…
Browse files Browse the repository at this point in the history
…uses error in data
  • Loading branch information
marinaglancy committed Sep 20, 2012
1 parent c366bea commit 7116aca
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/moodlelib.php
Expand Up @@ -10431,17 +10431,12 @@ function object_property_exists( $obj, $property ) {
*/
function convert_to_array($var) {
$result = array();
$references = array();

// loop over elements/properties
foreach ($var as $key => $value) {
// recursively convert objects
if (is_object($value) || is_array($value)) {
// but prevent cycles
if (!in_array($value, $references)) {
$result[$key] = convert_to_array($value);
$references[] = $value;
}
$result[$key] = convert_to_array($value);
} else {
// simple values are untouched
$result[$key] = $value;
Expand Down

0 comments on commit 7116aca

Please sign in to comment.