Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13982780
D20611.id49157.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.id49157.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
Mon, Oct 21, 1:57 AM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6734830
Default Alt Text
D20611.id49157.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