]> granicus.if.org Git - php/commitdiff
Properly exit on EOF on stdin in readline mode
authorBob Weinand <bobwei9@hotmail.com>
Tue, 7 Jul 2015 20:45:34 +0000 (22:45 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Tue, 7 Jul 2015 20:45:34 +0000 (22:45 +0200)
sapi/phpdbg/phpdbg_cmd.c
sapi/phpdbg/phpdbg_io.c

index 36f1a3f4ab2a8ac86c96041d64014bd38431fc12..9a3751a424d11ffbd9f18f36a67568cf193a03e5 100644 (file)
@@ -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
index 70709eadc1a53d84c174acb568b9d58a00e60fd1..246431ff2d71a8b33f53625cf6a4cc3f35c960a6 100644 (file)
@@ -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;