Page MenuHomePhabricator

D20611.id.diff
No OneTemporary

D20611.id.diff

diff --git a/src/symbols/PhutilClassMapQuery.php b/src/symbols/PhutilClassMapQuery.php
--- a/src/symbols/PhutilClassMapQuery.php
+++ b/src/symbols/PhutilClassMapQuery.php
@@ -287,7 +287,21 @@
// Apply the "sort" mechanism, if it is configured.
if (strlen($sort)) {
- $map = msort($map, $sort);
+ if ($map) {
+ // The "sort" method may return scalars (which we want to sort with
+ // "msort()"), or may return PhutilSortVector objects (which we want
+ // to sort with "msortv()").
+ $item = call_user_func(array(head($map), $sort));
+
+ // Since we may be early in the stack, use a string to avoid triggering
+ // autoload in old versions of PHP.
+ $vector_class = 'PhutilSortVector';
+ if ($item instanceof $vector_class) {
+ $map = msortv($map, $sort);
+ } else {
+ $map = msort($map, $sort);
+ }
+ }
}
return $map;

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 23, 10:37 PM (3 w, 23 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6734830
Default Alt Text
D20611.id.diff (945 B)

Event Timeline