Skip to content

Commit e177d26

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #77800 phpdbg segfaults on conditional breakpoints
2 parents 6ef6d31 + 7df8e4f commit e177d26

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ PHP NEWS
1616

1717
- phpdbg:
1818
. Fixed bug #76801 (too many open files). (alekitto)
19+
. Fixed bug #77800 (phpdbg segfaults on listing some conditional breakpoints).
20+
(krakjoe)
1921

2022
- Reflection:
2123
. Fixed bug #77772 (ReflectionClass::getMethods(null) doesn't work). (Nikita)

sapi/phpdbg/phpdbg_bp.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ PHPDBG_API void phpdbg_export_breakpoints_to_string(char **str) /* {{{ */
232232
} ZEND_HASH_FOREACH_END();
233233
}
234234

235-
if (!(*str)[0]) {
235+
if ((*str) && !(*str)[0]) {
236236
*str = NULL;
237237
}
238238
} /* }}} */
@@ -813,6 +813,21 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co
813813
uint32_t cops = CG(compiler_options);
814814
zval pv;
815815

816+
switch (param->type) {
817+
case STR_PARAM:
818+
case NUMERIC_FUNCTION_PARAM:
819+
case METHOD_PARAM:
820+
case NUMERIC_METHOD_PARAM:
821+
case FILE_PARAM:
822+
case ADDR_PARAM:
823+
/* do nothing */
824+
break;
825+
826+
default:
827+
phpdbg_error("eval", "type=\"invalidparameter\"", "Invalid parameter type for conditional breakpoint");
828+
return;
829+
}
830+
816831
PHPDBG_BREAK_INIT(new_break, PHPDBG_BREAK_COND);
817832
new_break.hash = hash;
818833

0 commit comments

Comments
 (0)