From b73a3afff333143b2908b280e6a4e26d61cb3138 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Wed, 30 Nov 2016 02:56:47 +0100 Subject: [PATCH] Fixed bug #73615 (phpdbg without option never load .phpdbginit at startup) --- NEWS | 4 ++++ sapi/phpdbg/phpdbg.c | 4 +--- sapi/phpdbg/phpdbg_prompt.c | 6 +++--- sapi/phpdbg/tests/bug73615.phpt | 18 ++++++++++++++++++ sapi/phpdbg/tests/bug73615/.phpdbginit | 2 ++ 5 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 sapi/phpdbg/tests/bug73615.phpt create mode 100644 sapi/phpdbg/tests/bug73615/.phpdbginit diff --git a/NEWS b/NEWS index 79ced5e62bf..1bd6df98cdd 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,10 @@ PHP NEWS . Fixed bug #73586 (php_user_filter::$stream is not set to the stream the filter is working on). (Dmitry) +- Phpdbg: + . Fixed bug #73615 (phpdbg without option never load .phpdbginit at startup). + (Bob) + 08 Dec 2016 PHP 7.0.14 - Core: diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index 148e18a454b..7eeaf48d79e 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -1874,9 +1874,7 @@ phpdbg_main: /* initialize from file */ PHPDBG_G(flags) |= PHPDBG_IS_INITIALIZING; zend_try { - if (init_file) { - phpdbg_init(init_file, init_file_len, init_file_default); - } + phpdbg_init(init_file, init_file_len, init_file_default); } zend_end_try(); PHPDBG_G(flags) &= ~PHPDBG_IS_INITIALIZING; diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index c126ce2029f..4ee27d1beb2 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -349,7 +349,9 @@ void phpdbg_try_file_init(char *init_file, size_t init_file_len, zend_bool free_ void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default) /* {{{ */ { - if (!init_file && use_default) { + if (init_file) { + phpdbg_try_file_init(init_file, init_file_len, 1); + } else if (use_default) { char *scan_dir = getenv("PHP_INI_SCAN_DIR"); char *sys_ini; int i; @@ -382,8 +384,6 @@ void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default) / } phpdbg_try_file_init(PHPDBG_STRL(PHPDBG_INIT_FILENAME), 0); - } else { - phpdbg_try_file_init(init_file, init_file_len, 1); } } /* }}} */ diff --git a/sapi/phpdbg/tests/bug73615.phpt b/sapi/phpdbg/tests/bug73615.phpt new file mode 100644 index 00000000000..ade957e50ed --- /dev/null +++ b/sapi/phpdbg/tests/bug73615.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #73615 (phpdbg without option never load .phpdbginit at startup) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Executed .phpdbginit diff --git a/sapi/phpdbg/tests/bug73615/.phpdbginit b/sapi/phpdbg/tests/bug73615/.phpdbginit new file mode 100644 index 00000000000..29184ddf7c8 --- /dev/null +++ b/sapi/phpdbg/tests/bug73615/.phpdbginit @@ -0,0 +1,2 @@ +ev "Executed .phpdbginit" +q