Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13996352
D20611.id49158.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
945 B
Referenced Files
None
Subscribers
None
D20611.id49158.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 24, 8:22 PM (3 w, 1 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6734830
Default Alt Text
D20611.id49158.diff (945 B)
Attached To
Mode
D20611: Allow "PhutilClassMapQuery" to sort with a PhutilSortVector sort function
Attached
Detach File
Event Timeline
Log In to Comment