MDL-35001 removed cycle detection from convert_to_array because it causes error in data

This commit is contained in:
Marina Glancy
2012-09-17 11:26:58 +08:00
parent 4db36990ee
commit 64346429fe
+1 -6
View File
@@ -10238,17 +10238,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;