Skip to content

Commit b73a3af

Browse files
committed
Fixed bug #73615 (phpdbg without option never load .phpdbginit at startup)
1 parent 9a9ad56 commit b73a3af

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ PHP NEWS
1313
. Fixed bug #73586 (php_user_filter::$stream is not set to the stream the
1414
filter is working on). (Dmitry)
1515

16+
- Phpdbg:
17+
. Fixed bug #73615 (phpdbg without option never load .phpdbginit at startup).
18+
(Bob)
19+
1620
08 Dec 2016 PHP 7.0.14
1721

1822
- Core:

sapi/phpdbg/phpdbg.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -1874,9 +1874,7 @@ int main(int argc, char **argv) /* {{{ */
18741874
/* initialize from file */
18751875
PHPDBG_G(flags) |= PHPDBG_IS_INITIALIZING;
18761876
zend_try {
1877-
if (init_file) {
1878-
phpdbg_init(init_file, init_file_len, init_file_default);
1879-
}
1877+
phpdbg_init(init_file, init_file_len, init_file_default);
18801878
} zend_end_try();
18811879
PHPDBG_G(flags) &= ~PHPDBG_IS_INITIALIZING;
18821880

sapi/phpdbg/phpdbg_prompt.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,9 @@ void phpdbg_try_file_init(char *init_file, size_t init_file_len, zend_bool free_
349349

350350
void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default) /* {{{ */
351351
{
352-
if (!init_file && use_default) {
352+
if (init_file) {
353+
phpdbg_try_file_init(init_file, init_file_len, 1);
354+
} else if (use_default) {
353355
char *scan_dir = getenv("PHP_INI_SCAN_DIR");
354356
char *sys_ini;
355357
int i;
@@ -382,8 +384,6 @@ void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default) /
382384
}
383385

384386
phpdbg_try_file_init(PHPDBG_STRL(PHPDBG_INIT_FILENAME), 0);
385-
} else {
386-
phpdbg_try_file_init(init_file, init_file_len, 1);
387387
}
388388
}
389389
/* }}} */

sapi/phpdbg/tests/bug73615.phpt

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Bug #73615 (phpdbg without option never load .phpdbginit at startup)
3+
--SKIPIF--
4+
<?php
5+
if (!getenv('TEST_PHPDBG_EXECUTABLE')) die("No TEST_PHPDBG_EXECUTABLE specified");
6+
?>
7+
--FILE--
8+
<?php
9+
10+
$phpdbg = getenv('TEST_PHPDBG_EXECUTABLE');
11+
12+
chdir(__DIR__."/bug73615");
13+
14+
print `$phpdbg -qn`;
15+
16+
?>
17+
--EXPECT--
18+
Executed .phpdbginit
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ev "Executed .phpdbginit"
2+
q

0 commit comments

Comments
 (0)