Page MenuHomePhabricator

D10374.id24983.diff
No OneTemporary

D10374.id24983.diff

diff --git a/bin/xhprofile b/bin/xhprofile
new file mode 120000
--- /dev/null
+++ b/bin/xhprofile
@@ -0,0 +1 @@
+../scripts/xhprofile.php
\ No newline at end of file
diff --git a/extension/tests/xhprof_009.phpt b/extension/tests/xhprof_009.phpt
new file mode 100644
--- /dev/null
+++ b/extension/tests/xhprof_009.phpt
@@ -0,0 +1,19 @@
+--TEST--
+XHPRrof: PHP 5.5 crash in hp_execute_internal
+Author: epriestley
+--FILE--
+<?php
+
+function loader() {
+ // <empty>
+}
+
+spl_autoload_register('loader', $throw = true);
+
+xhprof_enable();
+
+class_exists('ThisClassDoesNotExist');
+echo "OK\n";
+
+--EXPECT--
+OK
diff --git a/scripts/xhprofile.php b/scripts/xhprofile.php
new file mode 100755
--- /dev/null
+++ b/scripts/xhprofile.php
@@ -0,0 +1,19 @@
+#!/usr/bin/env php
+<?php
+
+// Profile a CLI script.
+
+if ($argc < 2) {
+ throw new Exception('usage: xhprofile <script>');
+}
+
+$__xhprof_target__ = $argv[1];
+
+$argv = array_slice($argv, 1);
+$argc = count($argv);
+
+xhprof_enable();
+require_once $__xhprof_target__;
+$xhprof_data = xhprof_disable();
+
+var_dump($xhprof_data);

File Metadata

Mime Type
text/plain
Expires
Mon, Feb 24, 7:36 PM (5 h, 15 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7191319
Default Alt Text
D10374.id24983.diff (1 KB)

Event Timeline