Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ PHP NEWS
. Fixed segfault in ReflectionMethod::createFromMethodName() on an
uninstantiable subclass. (iliaal)

- Readline:
. Fixed the interactive shell not waiting for the pager process to exit.
(Weilin Du)

- Sockets:
. Fixed socket_set_option() validation error messages for UDP_SEGMENT and
SO_LINGER options. (Weilin Du)
Expand Down
2 changes: 1 addition & 1 deletion ext/readline/readline_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ static int readline_shell_run(void) /* {{{ */
}

if (pager_pipe) {
fclose(pager_pipe);
pclose(pager_pipe);
pager_pipe = NULL;
}

Expand Down
29 changes: 29 additions & 0 deletions ext/readline/tests/readline_cli_pager.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--TEST--
Interactive shell: output through cli.pager
--EXTENSIONS--
readline
--SKIPIF--
<?php
if (!function_exists('proc_open')) die('skip proc_open() not available');
if (READLINE_LIB !== "readline") die('skip readline only');
if (PHP_OS_FAMILY === 'Windows') die('skip tr pager is not portable on Windows');
?>
--FILE--
<?php
$php = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
$ini = getenv('TEST_PHP_EXTRA_ARGS');
$descriptorspec = [['pipe', 'r'], STDOUT, STDERR];
$proc = proc_open("$php $ini -d cli.pager='tr a-z A-Z' -a", $descriptorspec, $pipes);
fwrite($pipes[0], "echo \"pager output\n\";\n");
fwrite($pipes[0], "quit\n");
fclose($pipes[0]);
proc_close($proc);
?>
--EXPECT--
Interactive shell

php > echo "pager output
php " ";
pager output
PAGER OUTPUT
php > quit
Loading