Page MenuHomePhabricator

D20611.diff
No OneTemporary

D20611.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
Tue, May 14, 10:53 AM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6288987
Default Alt Text
D20611.diff (945 B)

Event Timeline