Avoid PHP warning due to bogus second tideways_xhprof_enable() argument
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 25 Aug 2019 22:03:33 +0000 (15:03 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sun, 25 Aug 2019 22:03:33 +0000 (15:03 -0700)
Change-Id: I3d86d74e8a97eb578f392f9f1d918cc628d2bf4b

includes/libs/Xhprof.php

index a1ddfd0..575fbe7 100644 (file)
@@ -53,6 +53,12 @@ class Xhprof {
                if ( self::isEnabled() ) {
                        throw new Exception( 'Profiling is already enabled.' );
                }
+
+               $args = [ $flags ];
+               if ( $options ) {
+                       $args[] = $options;
+               }
+
                self::$enabled = true;
                self::callAny(
                        [
@@ -60,7 +66,7 @@ class Xhprof {
                                'tideways_enable',
                                'tideways_xhprof_enable'
                        ],
-                       [ $flags, $options ]
+                       $args
                );
        }