Skip to content

Commit e9c2e7d

Browse files
author
kovacs.ferenc
committed
fix bugsnet #67212: phpdbg uses non-standard TIOCGWINSZ
1 parent fbb7bdc commit e9c2e7d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

config.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PHP_ARG_ENABLE(phpdbg-debug, for phpdbg debug build,
99
[ --enable-phpdbg-debug Build phpdbg in debug mode], no, no)
1010

1111
if test "$PHP_PHPDBG" != "no"; then
12+
AC_HEADER_TIOCGWINSZ
1213
AC_DEFINE(HAVE_PHPDBG, 1, [ ])
1314

1415
if test "$PHP_PHPDBG_DEBUG" != "no"; then

phpdbg_utils.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
# include "win32/time.h"
3333
#elif defined(HAVE_SYS_IOCTL_H)
3434
# include "sys/ioctl.h"
35+
# ifndef GWINSZ_IN_SYS_IOCTL
36+
# include <termios.h>
37+
# endif
3538
#endif
3639

3740
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
@@ -437,7 +440,7 @@ PHPDBG_API int phpdbg_get_terminal_width(TSRMLS_D) /* {{{ */
437440

438441
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
439442
columns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
440-
#elif defined(HAVE_SYS_IOCTL_H)
443+
#elif defined(HAVE_SYS_IOCTL_H) && defined (TIOCGWINSZ)
441444
struct winsize w;
442445

443446
columns = ioctl(fileno(stdout), TIOCGWINSZ, &w) == 0 ? w.ws_col : 80;

0 commit comments

Comments
 (0)