Skip to content

Commit b47c220

Browse files
committed
Correctly sort object vars
1 parent 0f0da29 commit b47c220

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/Resource.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,16 @@ public function prepareForSerialization() {
216216
}
217217
}
218218
}
219-
asort($keys);
220-
return $keys;
221-
}
219+
$sortedArray = array();
220+
$arrayKeys = array_keys($keys);
221+
asort($arrayKeys, SORT_STRING | SORT_NATURAL);
222222

223+
foreach ($arrayKeys as $arrayKey) {
224+
$sortedArray[$arrayKey] = $keys[$arrayKey];
225+
}
223226

227+
return $sortedArray;
228+
}
224229

225230
private function initClientIfNeeded() {
226231
if (is_null($this->_client)) {

0 commit comments

Comments
 (0)