summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Watkins <krakjoe@php.net>2019-03-26 23:06:00 +0100
committerJoe Watkins <krakjoe@php.net>2019-03-26 23:06:15 +0100
commite177d26d0efe3d99df1405647cb0e17240460a95 (patch)
treef7fb8653fb5c7946feb5df7048893dfaf23f8c52
parent6ef6d31776ca4f796f761550e9d2137cbbb15a71 (diff)
parent7df8e4fc0abc105cd5d7b933499bdd275459f7ee (diff)
downloadphp-git-e177d26d0efe3d99df1405647cb0e17240460a95.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #77800 phpdbg segfaults on conditional breakpoints
-rw-r--r--NEWS2
-rw-r--r--sapi/phpdbg/phpdbg_bp.c17
2 files changed, 18 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index e5b41748e2..6a73dbb5d2 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ PHP NEWS
- phpdbg:
. Fixed bug #76801 (too many open files). (alekitto)
+ . Fixed bug #77800 (phpdbg segfaults on listing some conditional breakpoints).
+ (krakjoe)
- Reflection:
. Fixed bug #77772 (ReflectionClass::getMethods(null) doesn't work). (Nikita)
diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c
index a10d652e33..f370fc0525 100644
--- a/sapi/phpdbg/phpdbg_bp.c
+++ b/sapi/phpdbg/phpdbg_bp.c
@@ -232,7 +232,7 @@ PHPDBG_API void phpdbg_export_breakpoints_to_string(char **str) /* {{{ */
} ZEND_HASH_FOREACH_END();
}
- if (!(*str)[0]) {
+ if ((*str) && !(*str)[0]) {
*str = NULL;
}
} /* }}} */
@@ -813,6 +813,21 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co
uint32_t cops = CG(compiler_options);
zval pv;
+ switch (param->type) {
+ case STR_PARAM:
+ case NUMERIC_FUNCTION_PARAM:
+ case METHOD_PARAM:
+ case NUMERIC_METHOD_PARAM:
+ case FILE_PARAM:
+ case ADDR_PARAM:
+ /* do nothing */
+ break;
+
+ default:
+ phpdbg_error("eval", "type=\"invalidparameter\"", "Invalid parameter type for conditional breakpoint");
+ return;
+ }
+
PHPDBG_BREAK_INIT(new_break, PHPDBG_BREAK_COND);
new_break.hash = hash;