diff --git a/tests/bug01025.inc b/tests/bug01025.inc
new file mode 100644
index 000000000..acb6c3546
--- /dev/null
+++ b/tests/bug01025.inc
@@ -0,0 +1,2 @@
+
diff --git a/tests/bug01025.phpt b/tests/bug01025.phpt
new file mode 100644
index 000000000..b1c4f1eee
--- /dev/null
+++ b/tests/bug01025.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test for bug #1025: Xdebug does not reject wrong breakpoint types (-t)
+--FILE--
+
+--EXPECTF--
+
+
+
+-> step_into -i 1
+
+
+
+-> breakpoint_set -i 2 -t bakerstreet
+
+
+
+-> breakpoint_set -i 3 -t line -n 3
+
+
+
+-> breakpoint_set -i 4 -t conditional -n 3
+
+
+
+-> breakpoint_set -i 5 -t call -m strlen
+
+
+
+-> breakpoint_set -i 6 -t return -m strlen
+
+
+
+-> breakpoint_set -i 7 -t exception -x Exception
+
+
+
+-> breakpoint_set -i 8 -t watch
+
+
diff --git a/xdebug_handler_dbgp.c b/xdebug_handler_dbgp.c
index ce6f62530..eafd7ad37 100644
--- a/xdebug_handler_dbgp.c
+++ b/xdebug_handler_dbgp.c
@@ -1206,6 +1206,16 @@ DBGP_FUNC(breakpoint_set)
if (!CMD_OPTION('t')) {
RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS);
} else {
+ if (
+ (strcmp(CMD_OPTION('t'), "line") != 0) &&
+ (strcmp(CMD_OPTION('t'), "conditional") != 0) &&
+ (strcmp(CMD_OPTION('t'), "call") != 0) &&
+ (strcmp(CMD_OPTION('t'), "return") != 0) &&
+ (strcmp(CMD_OPTION('t'), "exception") != 0) &&
+ (strcmp(CMD_OPTION('t'), "watch") != 0)
+ ) {
+ RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_INVALID_ARGS);
+ }
brk_info->type = xdstrdup(CMD_OPTION('t'));
}