]> granicus.if.org Git - php/commitdiff
Revert "fix #46 ignore EOF"
authorkrakjoe <joe.watkins@live.co.uk>
Mon, 13 Jan 2014 08:12:49 +0000 (08:12 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Mon, 13 Jan 2014 08:12:49 +0000 (08:12 +0000)
This reverts commit 333264fdb718f337fb19d208e3d41aeef31f2ca1.

phpdbg.c
phpdbg_cmd.c

index c631d8f3c3ac61f2bd24c3f4138f0ab4b261bc80..1ada36c7a10beceffaa57926ee97f2bcf3fbc846 100644 (file)
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -1257,8 +1257,10 @@ phpdbg_interact:
                                                /* this must be forced */
                                                CG(unclean_shutdown) = 0;
                                        } else {
-                                               /* local consoles cannot disconnect, ignore EOF */
-                                               PHPDBG_G(flags) &= ~PHPDBG_IS_DISCONNECTED;
+                                               /* local client quit console */
+                                               CG(unclean_shutdown) = 0;
+                                               
+                                               goto phpdbg_out;
                                        }
                                }
 #endif
@@ -1273,7 +1275,7 @@ phpdbg_interact:
                
 phpdbg_out:
 #ifndef _WIN32
-               if ((PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED)) {
+               if (PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED) {
                        PHPDBG_G(flags) &= ~PHPDBG_IS_DISCONNECTED;
                        goto phpdbg_interact;
                }
@@ -1322,7 +1324,7 @@ phpdbg_out:
        if (cleaning || remote) {
                goto phpdbg_main;
        }
-       
+
 #ifdef ZTS
        /* bugggy */
        /* tsrm_shutdown(); */
index 501d0b8bf6d29c8014cc8332b504e3a649dbca31..9f052d6f6f38529e2b04b3b675122f193e54efa6 100644 (file)
@@ -467,43 +467,32 @@ PHPDBG_API phpdbg_input_t *phpdbg_read_input(char *buffered TSRMLS_DC) /* {{{ */
                }
 
                if (buffered == NULL) {
-disconnect:
-                       if (0) {
-                               PHPDBG_G(flags) |= (PHPDBG_IS_QUITTING|PHPDBG_IS_DISCONNECTED);
-                               zend_bailout();
-                               return NULL;
-                       }
-
 #ifndef HAVE_LIBREADLINE
                        char buf[PHPDBG_MAX_CMD];
-                       if (!(PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) {
-                               if (!phpdbg_write(phpdbg_get_prompt(TSRMLS_CC))) {
-                                       goto disconnect;
-                               }
-                       }
-                       
-                       /* note: EOF is ignored */
-readline:      
-                       if (!fgets(buf, PHPDBG_MAX_CMD, PHPDBG_G(io)[PHPDBG_STDIN])) {
+                       if ((!(PHPDBG_G(flags) & PHPDBG_IS_REMOTE) && !phpdbg_write(phpdbg_get_prompt(TSRMLS_C))) ||
+                               !fgets(buf, PHPDBG_MAX_CMD, PHPDBG_G(io)[PHPDBG_STDIN])) {
                                /* the user has gone away */
-                               if ((PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) {
-                                       goto disconnect;
-                               } else goto readline;
+                               phpdbg_error("Failed to read console!");
+                               PHPDBG_G(flags) |= (PHPDBG_IS_QUITTING|PHPDBG_IS_DISCONNECTED);
+                               zend_bailout();
+                               return NULL;
                        }
 
                        cmd = buf;
 #else
-                       /* note: EOF makes readline write prompt again in local console mode */
-readline:
                        if ((PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) {
                                char buf[PHPDBG_MAX_CMD];
                                if (fgets(buf, PHPDBG_MAX_CMD, PHPDBG_G(io)[PHPDBG_STDIN])) {
                                        cmd = buf;
-                               } else goto disconnect;
+                               } else cmd = NULL;
                        } else cmd = readline(phpdbg_get_prompt(TSRMLS_C));
 
                        if (!cmd) {
-                               goto readline;
+                               /* the user has gone away */
+                               phpdbg_error("Failed to read console!");
+                               PHPDBG_G(flags) |= (PHPDBG_IS_QUITTING|PHPDBG_IS_DISCONNECTED);
+                               zend_bailout();
+                               return NULL;
                        }
 
                        if (!(PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) {