com php-src: Properly exit on EOF on stdin in readline mode: sapi/phpdbg/phpdbg_cmd.c sapi/phpdbg/phpdbg_io.c
| From: | Bob Weinand | Date: | Tue, 07 Jul 2015 20:45:34 +0000 |
| Subject: | com php-src: Properly exit on EOF on stdin in readline mode: sapi/phpdbg/phpdbg_cmd.c sapi/phpdbg/phpdbg_io.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87827@lists.php.net to get a copy of this message | ||
Commit: 7a8ea0f60d4d4302be7231f4b73c08a209e696d0
Author: Bob Weinand <bobwei9@hotmail.com> Tue, 7 Jul 2015 22:45:34 +0200
Parents: b3a4c05071c3786e27e1326fa1b4d5acad62fccd
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7a8ea0f60d4d4302be7231f4b73c08a209e696d0
Log:
Properly exit on EOF on stdin in readline mode
Changed paths:
M sapi/phpdbg/phpdbg_cmd.c
M sapi/phpdbg/phpdbg_io.c
Diff:
diff --git a/sapi/phpdbg/phpdbg_cmd.c b/sapi/phpdbg/phpdbg_cmd.c
index 36f1a3f..9a3751a 100644
--- a/sapi/phpdbg/phpdbg_cmd.c
+++ b/sapi/phpdbg/phpdbg_cmd.c
@@ -729,11 +729,15 @@ readline:
PHPDBG_G(last_was_newline) = 1;
}
- if (!cmd) {
- goto readline;
- }
-
if (!(PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) {
+ if (!cmd) {
+ if (feof(PHPDBG_G(io)[PHPDBG_STDIN].ptr)) {
+ PHPDBG_G(flags) |= PHPDBG_IS_QUITTING | PHPDBG_IS_DISCONNECTED;
+ zend_bailout();
+ }
+ goto readline;
+ }
+
add_history(cmd);
}
#endif
diff --git a/sapi/phpdbg/phpdbg_io.c b/sapi/phpdbg/phpdbg_io.c
index 70709ea..246431f 100644
--- a/sapi/phpdbg/phpdbg_io.c
+++ b/sapi/phpdbg/phpdbg_io.c
@@ -90,7 +90,6 @@ PHPDBG_API int phpdbg_consume_stdin_line(char *buf) {
if (bytes <= 0) {
PHPDBG_G(flags) |= PHPDBG_IS_QUITTING | PHPDBG_IS_DISCONNECTED;
zend_bailout();
- return 0;
}
return bytes;