[php-src] master: sapi/phpdbg: remove dead str_type assignments before goto (#22600)

Jorg Adam Sowa via GitHub <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Jorg Adam Sowa (jorgsowa)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-07-08T15:40:23+01:00

Commit: https://github.com/php/php-src/commit/e7eebb9b1e834971bedf7bfbd7a19e1680e1ee7a
Raw diff: https://github.com/php/php-src/commit/e7eebb9b1e834971bedf7bfbd7a19e1680e1ee7a.diff

sapi/phpdbg: remove dead str_type assignments before goto (#22600)

The switch in phpdbg_print_breakpoints() assigned str_type per case
and jumped to a shared label that immediately recomputed the same
value from brake->type, making the pre-goto assignments dead. Set
str_type directly per case instead and drop the goto.

Changed paths:
  M  sapi/phpdbg/phpdbg_bp.c


Diff:

diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c
index f4e4ef81af2f..1233f0430121 100644
--- a/sapi/phpdbg/phpdbg_bp.c
+++ b/sapi/phpdbg/phpdbg_bp.c
@@ -1500,33 +1500,24 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type) /* {{{ */
 				switch (brake->type) {
 					case PHPDBG_BREAK_METHOD_OPLINE:
 						str_type = "method";
-						goto print_opline;
+						break;
 					case PHPDBG_BREAK_FUNCTION_OPLINE:
 						str_type = "function";
-						goto print_opline;
+						break;
 					case PHPDBG_BREAK_FILE_OPLINE:
-						str_type = "method";
-
-					print_opline: {
-						if (brake->type == PHPDBG_BREAK_METHOD_OPLINE) {
-							str_type = "method";
-						} else if (brake->type == PHPDBG_BREAK_FUNCTION_OPLINE) {
-							str_type = "function";
-						} else if (brake->type == PHPDBG_BREAK_FILE_OPLINE) {
-							str_type = "file";
-						}
-
-						phpdbg_writeln("#%d\t\t#"ZEND_ULONG_FMT"\t\t(%s breakpoint)%s",
-							brake->id, brake->opline, str_type,
-							((phpdbg_breakbase_t *) brake)->disabled ? " [disabled]" : "");
-					} break;
+						str_type = "file";
+						break;
 
 					default:
 						phpdbg_writeln("#%d\t\t#"ZEND_ULONG_FMT"%s",
 							brake->id, brake->opline,
 							((phpdbg_breakbase_t *) brake)->disabled ? " [disabled]" : "");
-						break;
+						continue;
 				}
+
+				phpdbg_writeln("#%d\t\t#"ZEND_ULONG_FMT"\t\t(%s breakpoint)%s",
+					brake->id, brake->opline, str_type,
+					((phpdbg_breakbase_t *) brake)->disabled ? " [disabled]" : "");
 			} ZEND_HASH_FOREACH_END();
 		} break;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.