Browse Source

Fix #27865; don't dup STDIN, STDOUT or STDERR when running under CLI.

PHP-5.0
Wez Furlong 23 years ago
parent
commit
daa90c915c
  1. 1
      NEWS
  2. 6
      ext/standard/php_fopen_wrapper.c

1
NEWS

@ -16,6 +16,7 @@ PHP NEWS
(Dmitry)
- Fixed bug #27997 (SPL: Crash with getInnerIterator()). (Marcus)
- Fixed bug #27928 (sqlite incorrectly handles invalid filenames). (Ilia)
- Fixed bug #27865 (STDIN, STDOUT, STDERR are dup()d under CLI). (Wez)
- Fixed bug #27821 (xml_parse() segfaults when xml_set_object() is called from
class method). (Andi, Rob)
- Fixed bug #27742 (WDSL SOAP Parsing Schema bug). (Dmitry)

6
ext/standard/php_fopen_wrapper.c

@ -166,11 +166,11 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, ch
}
if (!strcasecmp(path, "stdin")) {
fd = dup(STDIN_FILENO);
fd = !strcmp(sapi_module.name, "cli") ? STDIN_FILENO : dup(STDIN_FILENO);
} else if (!strcasecmp(path, "stdout")) {
fd = dup(STDOUT_FILENO);
fd = !strcmp(sapi_module.name, "cli") ? STDOUT_FILENO : dup(STDOUT_FILENO);
} else if (!strcasecmp(path, "stderr")) {
fd = dup(STDERR_FILENO);
fd = !strcmp(sapi_module.name, "cli") ? STDERR_FILENO : dup(STDERR_FILENO);
} else if (!strncasecmp(path, "filter/", 7)) {
/* Save time/memory when chain isn't specified */
if (strchr(mode, 'r') || strchr(mode, '+')) {

Loading…
Cancel
Save