diff --git a/src/SplArray.php b/src/SplArray.php index 4b949af..4406f2a 100644 --- a/src/SplArray.php +++ b/src/SplArray.php @@ -221,7 +221,7 @@ public function values(): SplArray public function flush():SplArray { - foreach ($this as $key => $item){ + foreach ($this->getArrayCopy() as $key => $item){ unset($this[$key]); } return $this; @@ -230,6 +230,7 @@ public function flush():SplArray public function loadArray(array $data) { parent::__construct($data); + return $this; } /* @@ -269,7 +270,7 @@ public function addCData($cdata_text) { } $parser($ch,$v); } else { - if (is_numeric($v)){ + if (is_numeric($k)){ $xml->addChild($k, $v); }else{ if($CD_DATA){