Anomie has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/337541 )

Change subject: Work around HHVM bug that prevents proper sorting from the 
profiler
......................................................................

Work around HHVM bug that prevents proper sorting from the profiler

The luasandbox profiler is supposed to return the profiled functions in
descending order. But HHVM's zend_hash_sort implementation just silently
ignores a specified sorting function and always does a ksort().

It's easy enough to just do an arsort() in PHP to get the results in the
correct order, so let's do that to work around it.

Bug: T158029
Change-Id: I0158dfc17db76b7207157b180d3afb63381127c4
---
M engines/LuaSandbox/Engine.php
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/41/337541/1

diff --git a/engines/LuaSandbox/Engine.php b/engines/LuaSandbox/Engine.php
index 22eb1e5..979a937 100644
--- a/engines/LuaSandbox/Engine.php
+++ b/engines/LuaSandbox/Engine.php
@@ -78,6 +78,11 @@
                        Scribunto_LuaSandboxInterpreter::SECONDS
                );
 
+               if ( defined( 'HHVM_VERSION' ) ) {
+                       // HHVM's zend_hash_sort doesn't work right (T158029)
+                       arsort( $percentProfile );
+               }
+
                $lines = array();
                $cumulativePercent = 0;
                $num = $otherTime = $otherPercent = 0;

-- 
To view, visit https://gerrit.wikimedia.org/r/337541
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0158dfc17db76b7207157b180d3afb63381127c4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: master
Gerrit-Owner: Anomie <bjor...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to