remi pushed to php-pecl-xdebug (master). "add patch for exception code change (for phpunit)"

notifications at fedoraproject.org notifications at fedoraproject.org
Fri May 29 08:30:35 UTC 2015


From 35f9b4121f8ca99dc83f79a54acdc306fae82f14 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi at fedoraproject.org>
Date: Fri, 29 May 2015 10:30:21 +0200
Subject: add patch for exception code change (for phpunit)


diff --git a/php-pecl-xdebug.spec b/php-pecl-xdebug.spec
index ade64c8..e16d60a 100644
--- a/php-pecl-xdebug.spec
+++ b/php-pecl-xdebug.spec
@@ -25,7 +25,7 @@
 Name:           php-pecl-xdebug
 Summary:        PECL package for debugging PHP scripts
 Version:        2.3.2
-Release:        2%{?dist}
+Release:        3%{?dist}
 Source0:        http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz
 
 # https://github.com/xdebug/xdebug/pull/172
@@ -33,6 +33,8 @@ Source0:        http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz
 Patch0:         %{pecl_name}-pr172.patch
 # https://github.com/xdebug/xdebug/pull/176
 Patch1:         %{pecl_name}-pr176.patch
+# https://github.com/xdebug/xdebug/pull/167
+Patch2:         %{pecl_name}-pr167.patch
 
 # The Xdebug License, version 1.01
 # (Based on "The PHP License", version 3.0)
@@ -86,6 +88,7 @@ Xdebug also provides:
 mv %{pecl_name}-%{version}%{?prever} NTS
 
 cd NTS
+%patch2 -p1 -b .pr167
 %patch0 -p1 -b .pr172
 %patch1 -p1 -b .pr176
 
@@ -218,6 +221,9 @@ fi
 
 
 %changelog
+* Fri May 29 2015 Remi Collet <remi at fedoraproject.org> - 2.3.2-3
+- add patch for exception code change (for phpunit)
+
 * Wed May 27 2015 Remi Collet <remi at fedoraproject.org> - 2.3.2-2
 - add patch for efree/str_efree in php 5.6
 - add patch for virtual_file_ex in 5.6 #1214111
diff --git a/xdebug-pr167.patch b/xdebug-pr167.patch
new file mode 100644
index 0000000..293f261
--- /dev/null
+++ b/xdebug-pr167.patch
@@ -0,0 +1,128 @@
+From b6da4dad4e2410de764964b61b17bdff7fa72cd9 Mon Sep 17 00:00:00 2001
+From: Derick Rethans <github at derickrethans.nl>
+Date: Tue, 31 Mar 2015 10:25:56 +0100
+Subject: [PATCH] Fixed issue #1133: PDO exception code value type is changed
+
+---
+ tests/bug01133.phpt   | 19 +++++++++++++++++++
+ xdebug.c              | 17 +++++++++++++++--
+ xdebug_handler_dbgp.c |  4 ++--
+ xdebug_handler_dbgp.h |  2 +-
+ xdebug_handlers.h     |  2 +-
+ xdebug_stack.c        |  6 +++++-
+ 6 files changed, 43 insertions(+), 7 deletions(-)
+ create mode 100644 tests/bug01133.phpt
+
+diff --git a/xdebug.c b/xdebug.c
+index e10449b..af6601e 100644
+--- a/xdebug.c
++++ b/xdebug.c
+@@ -1186,6 +1186,7 @@ static void xdebug_throw_exception_hook(zval *exception TSRMLS_DC)
+ 	zval *xdebug_message_trace, *previous_exception;
+ 	zend_class_entry *default_ce, *exception_ce;
+ 	xdebug_brk_info *extra_brk_info;
++	char *code_str = NULL;
+ 	char *exception_trace;
+ 	xdebug_str tmp_str = { 0, 0, NULL };
+ 
+@@ -1201,7 +1202,14 @@ static void xdebug_throw_exception_hook(zval *exception TSRMLS_DC)
+ 	file =    zend_read_property(default_ce, exception, "file",    sizeof("file")-1,    0 TSRMLS_CC);
+ 	line =    zend_read_property(default_ce, exception, "line",    sizeof("line")-1,    0 TSRMLS_CC);
+ 
+-	convert_to_long_ex(&code);
++	if (Z_TYPE_P(code) == IS_LONG) {
++		if (Z_LVAL_P(code) != 0) {
++			code_str = xdebug_sprintf("%lu", Z_LVAL_P(code));
++		}
++	} else if (Z_TYPE_P(code) != IS_STRING) {
++		code_str = xdstrdup("");
++	}
++
+ 	convert_to_string_ex(&message);
+ 	convert_to_string_ex(&file);
+ 	convert_to_long_ex(&line);
+@@ -1265,11 +1273,16 @@ static void xdebug_throw_exception_hook(zval *exception TSRMLS_DC)
+ 		}
+ 
+ 		if (exception_breakpoint_found && xdebug_handle_hit_value(extra_brk_info)) {
+-			if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), Z_STRVAL_P(file), Z_LVAL_P(line), XDEBUG_BREAK, (char *) exception_ce->name, Z_LVAL_P(code), Z_STRVAL_P(message))) {
++			if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), Z_STRVAL_P(file), Z_LVAL_P(line), XDEBUG_BREAK, (char *) exception_ce->name, code_str ? code_str : Z_STRVAL_P(code), Z_STRVAL_P(message))) {
+ 				XG(remote_enabled) = 0;
+ 			}
+ 		}
+ 	}
++
++	/* Free code_str if necessary */
++	if (code_str) {
++		xdfree(code_str);
++	}
+ }
+ 
+ static int handle_breakpoints(function_stack_entry *fse, int breakpoint_type)
+diff --git a/xdebug_handler_dbgp.c b/xdebug_handler_dbgp.c
+index ebbadc2..3265c4b 100644
+--- a/xdebug_handler_dbgp.c
++++ b/xdebug_handler_dbgp.c
+@@ -2342,7 +2342,7 @@ int xdebug_dbgp_error(xdebug_con *context, int type, char *exception_type, char
+ 	return 1;
+ }
+ 
+-int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file, long lineno, int type, char *exception, int code, char *message)
++int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file, long lineno, int type, char *exception, char *code, char *message)
+ {
+ 	xdebug_xml_node *response, *error_container;
+ 	TSRMLS_FETCH();
+@@ -2379,7 +2379,7 @@ int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file,
+ 		xdebug_xml_add_attribute_ex(error_container, "exception", xdstrdup(exception), 0, 1);
+ 	}
+ 	if (code) {
+-		xdebug_xml_add_attribute_ex(error_container, "code", xdebug_sprintf("%lu", code), 0, 1);
++		xdebug_xml_add_attribute_ex(error_container, "code", xdstrdup(code), 0, 1);
+ 	}
+ 	if (message) {
+ 		xdebug_xml_add_text(error_container, xdstrdup(message));
+diff --git a/xdebug_handler_dbgp.h b/xdebug_handler_dbgp.h
+index f875cde..0892d06 100644
+--- a/xdebug_handler_dbgp.h
++++ b/xdebug_handler_dbgp.h
+@@ -91,7 +91,7 @@ typedef struct xdebug_dbgp_cmd {
+ int xdebug_dbgp_init(xdebug_con *context, int mode);
+ int xdebug_dbgp_deinit(xdebug_con *context);
+ int xdebug_dbgp_error(xdebug_con *context, int type, char *exception_type, char *message, const char *location, const uint line, xdebug_llist *stack);
+-int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file, long lineno, int type, char *exception, int code, char *message);
++int xdebug_dbgp_breakpoint(xdebug_con *context, xdebug_llist *stack, char *file, long lineno, int type, char *exception, char *code, char *message);
+ int xdebug_dbgp_stream_output(const char *string, unsigned int length TSRMLS_DC);
+ int xdebug_dbgp_register_eval_id(xdebug_con *context, function_stack_entry *fse);
+ char *xdebug_dbgp_get_revision(void);
+diff --git a/xdebug_handlers.h b/xdebug_handlers.h
+index 73b0d77..dbd92f2 100644
+--- a/xdebug_handlers.h
++++ b/xdebug_handlers.h
+@@ -110,7 +110,7 @@ struct _xdebug_remote_handler {
+ 	int (*remote_error)(xdebug_con *h, int type, char *exception_type, char *message, const char *location, const uint line, xdebug_llist *stack);
+ 
+ 	/* Breakpoints */
+-	int (*remote_breakpoint)(xdebug_con *h, xdebug_llist *stack, char *file, long lineno, int type, char *exception, int code, char *message);
++	int (*remote_breakpoint)(xdebug_con *h, xdebug_llist *stack, char *file, long lineno, int type, char *exception, char *code, char *message);
+ 
+ 	/* Output redirection */
+ 	int (*remote_stream_output)(const char *string, unsigned int length TSRMLS_DC);
+diff --git a/xdebug_stack.c b/xdebug_stack.c
+index 40a71cc..a8d04d8 100644
+--- a/xdebug_stack.c
++++ b/xdebug_stack.c
+@@ -654,9 +654,13 @@ void xdebug_error_cb(int type, const char *error_filename, const uint error_line
+ 			xdebug_hash_find(XG(context).exception_breakpoints, "*", 1, (void *) &extra_brk_info)
+ 		) {
+ 			if (xdebug_handle_hit_value(extra_brk_info)) {
+-				if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), (char *) error_filename, error_lineno, XDEBUG_BREAK, error_type_str, type, buffer)) {
++				char *type_str = xdebug_sprintf("%ld", type);
++
++				if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), (char *) error_filename, error_lineno, XDEBUG_BREAK, error_type_str, type_str, buffer)) {
+ 					XG(remote_enabled) = 0;
+ 				}
++
++				xdfree(type_str);
+ 			}
+ 		}
+ 	}
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/php-pecl-xdebug.git/commit/?h=master&id=35f9b4121f8ca99dc83f79a54acdc306fae82f14


More information about the scm-commits mailing list