]> granicus.if.org Git - php/commitdiff
Fix crash on Linux due to double fclose()
authorBob Weinand <bobwei9@hotmail.com>
Mon, 3 Oct 2016 10:55:06 +0000 (12:55 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Mon, 3 Oct 2016 10:55:06 +0000 (12:55 +0200)
sapi/phpdbg/phpdbg.c

index 618a72f4294f44814a985e2c452103e15174b9a2..8b1dde57681b89351dd9528ce59a2b2dfdfb4b73 100644 (file)
@@ -1296,7 +1296,7 @@ php_stream *phpdbg_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *
        }
 
        if (!strncasecmp(path, "stdin", 6) && PHPDBG_G(stdin_file)) {
-               php_stream *stream =stream = php_stream_fopen_from_file(PHPDBG_G(stdin_file), "r");
+               php_stream *stream = php_stream_fopen_from_fd(dup(fileno(PHPDBG_G(stdin_file))), "r", NULL);
 #ifdef PHP_WIN32
                zval *blocking_pipes = php_stream_context_get_option(context, "pipe", "blocking");
                if (blocking_pipes) {