iliaa Fri Nov 3 13:34:19 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard php_fopen_wrapper.c
/php-src NEWS
Log:
Fixed bug #39215 (Inappropriate close of stdin/stdout/stderr).
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/php_fopen_wrapper.c?r1=1.45.2.4.2.2&r2=1.45.2.4.2.3&diff_format=u
Index: php-src/ext/standard/php_fopen_wrapper.c
diff -u php-src/ext/standard/php_fopen_wrapper.c:1.45.2.4.2.2
php-src/ext/standard/php_fopen_wrapper.c:1.45.2.4.2.3
--- php-src/ext/standard/php_fopen_wrapper.c:1.45.2.4.2.2 Wed Jul 5
17:38:14 2006
+++ php-src/ext/standard/php_fopen_wrapper.c Fri Nov 3 13:34:18 2006
@@ -17,7 +17,7 @@
| Hartmut Holzgraefe <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_fopen_wrapper.c,v 1.45.2.4.2.2 2006/07/05 17:38:14 iliaa Exp $ */
+/* $Id: php_fopen_wrapper.c,v 1.45.2.4.2.3 2006/11/03 13:34:18 iliaa Exp $ */
#include <stdio.h>
#include <stdlib.h>
@@ -191,11 +191,41 @@
}
if (!strcasecmp(path, "stdin")) {
- fd = !strcmp(sapi_module.name, "cli") ? STDIN_FILENO :
dup(STDIN_FILENO);
+ if (!strcmp(sapi_module.name, "cli")) {
+ static int cli_in = 0;
+ fd = STDIN_FILENO;
+ if (cli_in) {
+ fd = dup(fd);
+ } else {
+ cli_in = 1;
+ }
+ } else {
+ fd = dup(STDIN_FILENO);
+ }
} else if (!strcasecmp(path, "stdout")) {
- fd = !strcmp(sapi_module.name, "cli") ? STDOUT_FILENO :
dup(STDOUT_FILENO);
+ if (!strcmp(sapi_module.name, "cli")) {
+ static int cli_out = 0;
+ fd = STDOUT_FILENO;
+ if (cli_out++) {
+ fd = dup(fd);
+ } else {
+ cli_out = 1;
+ }
+ } else {
+ fd = dup(STDOUT_FILENO);
+ }
} else if (!strcasecmp(path, "stderr")) {
- fd = !strcmp(sapi_module.name, "cli") ? STDERR_FILENO :
dup(STDERR_FILENO);
+ if (!strcmp(sapi_module.name, "cli")) {
+ static int cli_err = 0;
+ fd = STDERR_FILENO;
+ if (cli_err++) {
+ fd = dup(fd);
+ } else {
+ cli_err = 1;
+ }
+ } else {
+ fd = dup(STDERR_FILENO);
+ }
} else if (!strncasecmp(path, "filter/", 7)) {
/* Save time/memory when chain isn't specified */
if (strchr(mode, 'r') || strchr(mode, '+')) {
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.319&r2=1.2027.2.547.2.320&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.319 php-src/NEWS:1.2027.2.547.2.320
--- php-src/NEWS:1.2027.2.547.2.319 Fri Nov 3 13:19:07 2006
+++ php-src/NEWS Fri Nov 3 13:34:19 2006
@@ -3,6 +3,7 @@
?? ??? 2007, PHP 5.2.1
- Fixed bug #39265 (Fixed path handling inside mod_files.sh).
(michal dot taborsky at gmail dot com, Ilia)
+- Fixed bug #39215 (Inappropriate close of stdin/stdout/stderr). (Wez,Ilia)
- Fixed bug #38680 (Added missing handling of basic types in json_decode).
(Ilia)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php