Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 116 lines (105 sloc) 4.662 kB
ce6dc3e @derickr - Made Xdebug compile with all PHP 4.3.x versions by embedding the no…
authored
1 /*
2 +----------------------------------------------------------------------+
4ceef7f @derickr - Re-license file.
authored
3 | Xdebug |
ce6dc3e @derickr - Made Xdebug compile with all PHP 4.3.x versions by embedding the no…
authored
4 +----------------------------------------------------------------------+
05871b5 @derickr - Happy 2010!
authored
5 | Copyright (c) 2002-2010 Derick Rethans <derick@xdebug.org> |
4ceef7f @derickr - Re-license file.
authored
6 | (c) 1997-2004 Jim Winstead <jimw@trainedmonkey.com> |
7 | (c) 1998-2004 Andi Gutmans <andi@zend.com> and |
8 | Zeev Suraski <zeev@zend.com> |
ce6dc3e @derickr - Made Xdebug compile with all PHP 4.3.x versions by embedding the no…
authored
9 +----------------------------------------------------------------------+
4ceef7f @derickr - Re-license file.
authored
10 | This source file is subject to the following Modified BSD license: |
11 | |
12 | Redistribution and use in source and binary forms, with or without |
13 | modification, are permitted provided that the following conditions |
14 | are met: |
15 | |
16 | 1. Redistributions of source code must retain the above copyright |
17 | notice, this list of conditions and the following disclaimer. |
18 | |
19 | 2. Redistributions in binary form must reproduce the above |
20 | copyright notice, this list of conditions and the following |
21 | disclaimer in the documentation and/or other materials provided |
22 | with the distribution. |
23 | |
24 | 3. The name of the author may not be used to endorse or promote |
25 | products derived from this software without specific prior |
26 | written permission. |
27 | |
28 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
29 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
30 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
31 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
32 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
33 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
34 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
35 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
36 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
37 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
38 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
ce6dc3e @derickr - Made Xdebug compile with all PHP 4.3.x versions by embedding the no…
authored
39 +----------------------------------------------------------------------+
40 */
05871b5 @derickr - Happy 2010!
authored
41 /* $Id: xdebug_compat.c,v 1.13 2010-05-07 20:39:13 derick Exp $ */
ce6dc3e @derickr - Made Xdebug compile with all PHP 4.3.x versions by embedding the no…
authored
42
43 #include "php.h"
44 #include "main/php_version.h"
45 #include "xdebug_compat.h"
2e42bef - Make compatible with PHP 5.1.x
Marcus Börger authored
46 #include "zend_extensions.h"
ce6dc3e @derickr - Made Xdebug compile with all PHP 4.3.x versions by embedding the no…
authored
47
ddcc347 - Enable build with PHP 6
Marcus Börger authored
48 #if PHP_MAJOR_VERSION >= 6
49 void xdebug_php_var_dump(zval **struc, int level TSRMLS_DC)
50 {
51 php_var_dump(struc, 1, 1 TSRMLS_CC);
52 }
ce6dc3e @derickr - Made Xdebug compile with all PHP 4.3.x versions by embedding the no…
authored
53 #endif
1b40076 @derickr - Implemented showing returng values in traces. The xdebug.collect_re…
authored
54
c5656b1 @derickr - Fixed bug #570: undefined symbol: zend_memrchr.
authored
55 #if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1
56 void *php_zend_memrchr(const void *s, int c, size_t n)
57 {
58 register unsigned char *e;
59
60 if (n <= 0) {
61 return NULL;
62 }
63
64 for (e = (unsigned char *)s + n - 1; e >= (unsigned char *)s; e--) {
65 if (*e == (unsigned char)c) {
66 return (void *)e;
67 }
68 }
69
70 return NULL;
71 }
72 #endif
16727cf @derickr - Implement collecting return values for PHP 4.3.x correctly.
authored
73
1b40076 @derickr - Implemented showing returng values in traces. The xdebug.collect_re…
authored
74 #define T(offset) (*(temp_variable *)((char *) Ts + offset))
75
76 zval *xdebug_zval_ptr(znode *node, temp_variable *Ts TSRMLS_DC)
77 {
78 switch (node->op_type) {
79 case IS_CONST:
80 return &node->u.constant;
81 break;
82 case IS_TMP_VAR:
83 return &T(node->u.var).tmp_var;
84 break;
85 case IS_VAR:
86 if (T(node->u.var).var.ptr) {
87 return T(node->u.var).var.ptr;
88 } else {
89 temp_variable *T = &T(node->u.var);
90 zval *str = T->str_offset.str;
91
92 if (T->str_offset.str->type != IS_STRING
93 || ((int)T->str_offset.offset<0)
94 || (T->str_offset.str->value.str.len <= T->str_offset.offset)) {
95 zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset);
2e42bef - Make compatible with PHP 5.1.x
Marcus Börger authored
96 T->tmp_var.value.str.val = STR_EMPTY_ALLOC();
1b40076 @derickr - Implemented showing returng values in traces. The xdebug.collect_re…
authored
97 T->tmp_var.value.str.len = 0;
98 } else {
99 char c = str->value.str.val[T->str_offset.offset];
100
101 T->tmp_var.value.str.val = estrndup(&c, 1);
102 T->tmp_var.value.str.len = 1;
103 }
e4d30d3 @derickr - MF2.0: PHP 5.3 compatibility.
authored
104 T->tmp_var.XDEBUG_REFCOUNT=1;
105 T->tmp_var.XDEBUG_IS_REF=1;
1b40076 @derickr - Implemented showing returng values in traces. The xdebug.collect_re…
authored
106 T->tmp_var.type = IS_STRING;
107 return &T->tmp_var;
108 }
109 break;
110 case IS_UNUSED:
111 return NULL;
112 break;
113 }
114 return NULL;
115 }
Something went wrong with that request. Please try again.