Date: Wed Aug 10 19:18:33 CEST 2005
User: Derick Rethans
Directory: xdebug
Log Message:
- Fixed bug #133: PHP scripts exits with 0 on PHP error.
- Make it compile with PHP 6.0dev
Modified files:
xdebug/xdebug.c (version: 1.267)
xdebug/xdebug_compat.c (version: 1.7)
[FILE: /xdebug/xdebug.c]
===================================================================
RCS file: cvstemp,v
retrieving revision 1.266
retrieving revision 1.267
diff -u -r1.266 -r1.267
--- xdebug/xdebug.c:1.266 Thu Jul 21 13:40:35 2005 GMT
+++ xdebug/xdebug.c Wed Aug 10 15:18:33 2005 GMT
@@ -54,7 +54,7 @@
#include "zend_extensions.h"
#ifdef ZEND_ENGINE_2
# include "zend_exceptions.h"
-# if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1
+# if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1) || PHP_MAJOR_VERSION >= 6
# include "zend_vm.h"
# endif
#endif
@@ -87,29 +87,13 @@
#ifdef ZEND_ENGINE_2
void xdebug_throw_exception_hook(zval *exception TSRMLS_DC);
+#endif
+#ifdef ZEND_ENGINE_2
# if PHP_MINOR_VERSION == 0
int (*old_exit_handler)(ZEND_OPCODE_HANDLER_ARGS);
-
-static int (*old_jmp_handler)(ZEND_OPCODE_HANDLER_ARGS);
-static int (*old_jmpz_handler)(ZEND_OPCODE_HANDLER_ARGS);
-
-static int (*old_is_identical_handler)(ZEND_OPCODE_HANDLER_ARGS);
-static int (*old_is_not_identical_handler)(ZEND_OPCODE_HANDLER_ARGS);
-static int (*old_is_equal_handler)(ZEND_OPCODE_HANDLER_ARGS);
-static int (*old_is_not_equal_handler)(ZEND_OPCODE_HANDLER_ARGS);
-static int (*old_is_smaller_handler)(ZEND_OPCODE_HANDLER_ARGS);
-static int (*old_is_smaller_or_equal_handler)(ZEND_OPCODE_HANDLER_ARGS);
# endif
int xdebug_exit_handler(ZEND_OPCODE_HANDLER_ARGS);
-static int xdebug_jmp_handler(ZEND_OPCODE_HANDLER_ARGS);
-static int xdebug_jmpz_handler(ZEND_OPCODE_HANDLER_ARGS);
-static int xdebug_is_identical_handler(ZEND_OPCODE_HANDLER_ARGS);
-static int xdebug_is_not_identical_handler(ZEND_OPCODE_HANDLER_ARGS);
-static int xdebug_is_equal_handler(ZEND_OPCODE_HANDLER_ARGS);
-static int xdebug_is_not_equal_handler(ZEND_OPCODE_HANDLER_ARGS);
-static int xdebug_is_smaller_handler(ZEND_OPCODE_HANDLER_ARGS);
-static int xdebug_is_smaller_or_equal_handler(ZEND_OPCODE_HANDLER_ARGS);
#endif
static zval *get_zval(znode *node, temp_variable *Ts, int *is_var);
@@ -443,6 +427,58 @@
xdebug_arg_dtor(parts);
}
+#ifdef ZEND_ENGINE_2
+/* Needed for code coverage as Zend doesn't always add EXT_STMT when expected */
+# if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1) || PHP_MAJOR_VERSION >= 6
+#define XDEBUG_OPCODE_OVERRIDE(f) static int xdebug_##f##_handler(ZEND_OPCODE_HANDLER_ARGS) \
+{ \
+ if (XG(do_code_coverage)) { \
+ zend_op *cur_opcode; \
+ int lineno; \
+ char *file; \
+ int file_len; \
+ zend_op_array *op_array = execute_data->op_array; \
+\
+ cur_opcode = *EG(opline_ptr); \
+ lineno = cur_opcode->lineno; \
+\
+ file = op_array->filename; \
+ file_len = strlen(file); \
+\
+ xdebug_count_line(file, lineno, 0 TSRMLS_CC); \
+ } \
+ return ZEND_USER_OPCODE_DISPATCH; \
+}
+#else
+#define XDEBUG_OPCODE_OVERRIDE(f) static int xdebug_##f##_handler(ZEND_OPCODE_HANDLER_ARGS) \
+{ \
+ if (XG(do_code_coverage)) { \
+ zend_op *cur_opcode; \
+ int lineno; \
+ char *file; \
+ int file_len; \
+\
+ cur_opcode = *EG(opline_ptr); \
+ lineno = cur_opcode->lineno; \
+\
+ file = op_array->filename; \
+ file_len = strlen(file); \
+\
+ xdebug_count_line(file, lineno, 0 TSRMLS_CC); \
+ } \
+ return old_##f##_handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); \
+}
+#endif
+XDEBUG_OPCODE_OVERRIDE(jmp)
+XDEBUG_OPCODE_OVERRIDE(jmpz)
+XDEBUG_OPCODE_OVERRIDE(is_identical)
+XDEBUG_OPCODE_OVERRIDE(is_not_identical)
+XDEBUG_OPCODE_OVERRIDE(is_equal)
+XDEBUG_OPCODE_OVERRIDE(is_not_equal)
+XDEBUG_OPCODE_OVERRIDE(is_smaller)
+XDEBUG_OPCODE_OVERRIDE(is_smaller_or_equal)
+#endif
+
PHP_MINIT_FUNCTION(xdebug)
{
@@ -473,8 +509,7 @@
new_error_cb = xdebug_error_cb;
/* Overload the "exit" opcode */
-#ifdef ZEND_ENGINE_2
-# if PHP_MINOR_VERSION == 0
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 0)
old_exit_handler = zend_opcode_handlers[ZEND_EXIT];
zend_opcode_handlers[ZEND_EXIT] = xdebug_exit_handler;
@@ -495,7 +530,8 @@
zend_opcode_handlers[ZEND_IS_NOT_EQUAL] = xdebug_is_not_equal_handler;
zend_opcode_handlers[ZEND_IS_SMALLER] = xdebug_is_smaller_handler;
zend_opcode_handlers[ZEND_IS_SMALLER_OR_EQUAL] = xdebug_is_smaller_or_equal_handler;
-# else
+#endif
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1) || PHP_MAJOR_VERSION >= 6
zend_set_user_opcode_handler(ZEND_EXIT, xdebug_exit_handler);
zend_set_user_opcode_handler(ZEND_JMP, xdebug_jmp_handler);
zend_set_user_opcode_handler(ZEND_JMPZ, xdebug_jmpz_handler);
@@ -505,7 +541,6 @@
zend_set_user_opcode_handler(ZEND_IS_NOT_EQUAL, xdebug_is_not_equal_handler);
zend_set_user_opcode_handler(ZEND_IS_SMALLER, xdebug_is_smaller_handler);
zend_set_user_opcode_handler(ZEND_IS_SMALLER_OR_EQUAL, xdebug_is_smaller_or_equal_handler);
-# endif
#endif
if (zend_xdebug_initialised == 0) {
@@ -932,7 +967,7 @@
}
while (i < j) {
-#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1
+# if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1) || PHP_MAJOR_VERSION >= 6
char *cv = NULL;
int cv_len;
@@ -1609,56 +1644,6 @@
}
}
-/* Needed for code coverage as Zend doesn't always add EXT_STMT when expected */
-#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1
-#define XDEBUG_OPCODE_OVERRIDE(f) static int xdebug_##f##_handler(ZEND_OPCODE_HANDLER_ARGS) \
-{ \
- if (XG(do_code_coverage)) { \
- zend_op *cur_opcode; \
- int lineno; \
- char *file; \
- int file_len; \
- zend_op_array *op_array = execute_data->op_array; \
-\
- cur_opcode = *EG(opline_ptr); \
- lineno = cur_opcode->lineno; \
-\
- file = op_array->filename; \
- file_len = strlen(file); \
-\
- xdebug_count_line(file, lineno, 0 TSRMLS_CC); \
- } \
- return ZEND_USER_OPCODE_DISPATCH; \
-}
-#else
-#define XDEBUG_OPCODE_OVERRIDE(f) static int xdebug_##f##_handler(ZEND_OPCODE_HANDLER_ARGS) \
-{ \
- if (XG(do_code_coverage)) { \
- zend_op *cur_opcode; \
- int lineno; \
- char *file; \
- int file_len; \
-\
- cur_opcode = *EG(opline_ptr); \
- lineno = cur_opcode->lineno; \
-\
- file = op_array->filename; \
- file_len = strlen(file); \
-\
- xdebug_count_line(file, lineno, 0 TSRMLS_CC); \
- } \
- return old_##f##_handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); \
-}
-#endif
-XDEBUG_OPCODE_OVERRIDE(jmp)
-XDEBUG_OPCODE_OVERRIDE(jmpz)
-XDEBUG_OPCODE_OVERRIDE(is_identical)
-XDEBUG_OPCODE_OVERRIDE(is_not_identical)
-XDEBUG_OPCODE_OVERRIDE(is_equal)
-XDEBUG_OPCODE_OVERRIDE(is_not_equal)
-XDEBUG_OPCODE_OVERRIDE(is_smaller)
-XDEBUG_OPCODE_OVERRIDE(is_smaller_or_equal)
-
/* Opcode handler for exit, to be able to clean up the profiler */
int xdebug_exit_handler(ZEND_OPCODE_HANDLER_ARGS)
{
@@ -1666,7 +1651,7 @@
xdebug_profiler_deinit(TSRMLS_C);
}
-#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1) || PHP_MAJOR_VERSION >= 6
return ZEND_USER_OPCODE_DISPATCH;
#else
return old_exit_handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -1736,6 +1721,7 @@
/*case E_PARSE: the parser would return 1 (failure), we can bail out nicely */
case E_COMPILE_ERROR:
case E_USER_ERROR:
+ EG(exit_status) = 255;
if (!XG(ignore_fatal_error)) {
zend_bailout();
}
@@ -2025,19 +2011,19 @@
PHP_FUNCTION(xdebug_enable)
{
zend_error_cb = new_error_cb;
-#ifdef ZEND_ENGINE_2
-# if PHP_MINOR_VERSION == 0
- zend_opcode_handlers[ZEND_EXIT] = xdebug_exit_handler;
-# endif
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1) || PHP_MAJOR_VERSION >= 6
zend_throw_exception_hook = xdebug_throw_exception_hook;
#endif
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 0)
+ zend_opcode_handlers[ZEND_EXIT] = xdebug_exit_handler;
+#endif
}
PHP_FUNCTION(xdebug_disable)
{
zend_error_cb = old_error_cb;
#ifdef ZEND_ENGINE_2
-# if PHP_MINOR_VERSION == 0
+# if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 0)
zend_opcode_handlers[ZEND_EXIT] = old_exit_handler;
# endif
zend_throw_exception_hook = NULL;
@@ -2382,7 +2368,13 @@
ZEND_DLEXPORT int xdebug_zend_startup(zend_extension *extension)
{
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1) || PHP_MAJOR_VERSION == 6
+ TSRMLS_FETCH();
+#endif
zend_xdebug_initialised = 1;
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1) || PHP_MAJOR_VERSION == 6
+ return zend_startup_module(&xdebug_module_entry TSRMLS_CC);
+#else
return zend_startup_module(&xdebug_module_entry);
}
[FILE: /xdebug/xdebug_compat.c]
===================================================================
RCS file: cvstemp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- xdebug/xdebug_compat.c:1.6 Thu Nov 11 15:30:12 2004 GMT
+++ xdebug/xdebug_compat.c Wed Aug 10 15:18:33 2005 GMT
@@ -16,7 +16,7 @@
| Modifications: Derick Rethans <derick[@]xdebug.org> |
+----------------------------------------------------------------------+
*/
-/* $Id: cvstemp,v 1.6 2004/11/11 16:30:12 derick Exp $ */
+/* $Id: cvstemp,v 1.7 2005/08/10 17:18:33 derick Exp $ */
#include "php.h"
#include "main/php_version.h"
@@ -303,7 +303,7 @@
|| ((int)T->str_offset.offset<0)
|| (T->str_offset.str->value.str.len <= T->str_offset.offset)) {
zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset);
-#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1) || PHP_MAJOR_VERSION == 6
T->tmp_var.value.str.val = STR_EMPTY_ALLOC();
#else
T->tmp_var.value.str.val = empty_string;
Received on Wed Aug 10 2005 - 19:18:36 BST
This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST