mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
MDL-35001 removed cycle detection from convert_to_array because it causes error in data
This commit is contained in:
parent
a3ab18c735
commit
9367fd911d
@ -10507,17 +10507,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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user