Skip to content

Commit fc087ed

Browse files
committed
Merge branch 'PHP-5.6'
Conflicts: ext/readline/readline.c
2 parents b046733 + edd1683 commit fc087ed

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

ext/readline/readline.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,13 @@ PHP_FUNCTION(readline_read_history)
402402
return;
403403
}
404404

405-
if (php_check_open_basedir(arg)) {
405+
if (arg && php_check_open_basedir(arg)) {
406406
RETURN_FALSE;
407407
}
408408

409409
/* XXX from & to NYI */
410410
if (read_history(arg)) {
411+
/* If filename is NULL, then read from `~/.history' */
411412
RETURN_FALSE;
412413
} else {
413414
RETURN_TRUE;
@@ -426,7 +427,7 @@ PHP_FUNCTION(readline_write_history)
426427
return;
427428
}
428429

429-
if (php_check_open_basedir(arg)) {
430+
if (arg && php_check_open_basedir(arg)) {
430431
RETURN_FALSE;
431432
}
432433

ext/readline/tests/bug69054.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Bug #69054 (Null dereference in readline_(read|write)_history() without parameters)
3+
--SKIPIF--
4+
<?php if (!extension_loaded("readline") || !function_exists('readline_add_history')) die("skip"); ?>
5+
--INI--
6+
open_basedir=/tmp
7+
--FILE--
8+
<?php readline_read_history(); ?>
9+
==DONE==
10+
--EXPECT--
11+
==DONE==

0 commit comments

Comments
 (0)