summaryrefslogtreecommitdiffstats
path: root/xhprof-php54.patch
blob: 92cd2319db3dea8375e6af0668eb89eb337b4580 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From a6bae51236677d95cb329d5b20806465c0260394 Mon Sep 17 00:00:00 2001
From: Scott MacVicar <scott@fb.com>
Date: Sat, 16 Jul 2011 14:43:01 -0700
Subject: [PATCH] Fixed PHP 5.4 building

Summary:
Fixed PHP 5.4 building
* class names became constants
* return_reference is stored in zend_function.fn_flags
* deal with znode reorganisation

Test Plan:
Build against php 5.4
Build against php 5.3

Reviewers: scoates

CC:

Differential Revision: 682
---
 extension/xhprof.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/extension/xhprof.c b/extension/xhprof.c
index 7001d12..33311b3 100644
--- a/extension/xhprof.c
+++ b/extension/xhprof.c
@@ -28,6 +28,7 @@
 #include "php_ini.h"
 #include "ext/standard/info.h"
 #include "php_xhprof.h"
+#include "Zend/zend_extensions.h"
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <stdlib.h>
@@ -898,7 +899,7 @@ size_t hp_get_function_stack(hp_entry_t *entry,
 static char *hp_get_function_name(zend_op_array *ops TSRMLS_DC) {
   zend_execute_data *data;
   char              *func = NULL;
-  char              *cls = NULL;
+  const char        *cls = NULL;
   char              *ret = NULL;
   int                len;
   zend_function      *curr_func;
@@ -942,7 +943,12 @@ size_t hp_get_function_stack(hp_entry_t *entry,
       /* we are dealing with a special directive/function like
        * include, eval, etc.
        */
+#if ZEND_EXTENSION_API_NO >= 220100525
+      curr_op = data->opline->extended_value;
+#else
       curr_op = data->opline->op2.u.constant.value.lval;
+#endif
+
       switch (curr_op) {
         case ZEND_EVAL:
           func = "eval";
@@ -1660,13 +1666,22 @@ ZEND_DLEXPORT void hp_execute_internal(zend_execute_data *execute_data,
   if (!_zend_execute_internal) {
     /* no old override to begin with. so invoke the builtin's implementation  */
     zend_op *opline = EX(opline);
+#if ZEND_EXTENSION_API_NO >= 220100525
+    temp_variable *retvar = &EX_T(opline->result.var);
+    ((zend_internal_function *) EX(function_state).function)->handler(
+                       opline->extended_value,
+                       retvar->var.ptr,
+                       (EX(function_state).function->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ?
+                       &retvar->var.ptr:NULL,
+                       EX(object), ret TSRMLS_CC);
+#else
     ((zend_internal_function *) EX(function_state).function)->handler(
                        opline->extended_value,
                        EX_T(opline->result.u.var).var.ptr,
                        EX(function_state).function->common.return_reference ?
                        &EX_T(opline->result.u.var).var.ptr:NULL,
                        EX(object), ret TSRMLS_CC);
-
+#endif
   } else {
     /* call the old override */
     _zend_execute_internal(execute_data, ret TSRMLS_CC);
-- 
1.7.5.4