From: Ilia Alshanetsky Date: Mon, 6 Dec 2004 23:31:07 +0000 (+0000) Subject: MFH: Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag). X-Git-Tag: php-5.0.3RC2~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4c4bfd3c9b539a42d9bcd6851541e8a6340ec524;p=php MFH: Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag). --- diff --git a/NEWS b/NEWS index f48838fcf4..c62741ff86 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ PHP NEWS - Extended the functionality of is_subclass_of() to accept either a class name or an object as first parameter. (Andrey) - Fixed potential problems with unserializing invalid serialize data. (Marcus) +- Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag). (Ilia) - Fixed bug #30967 (properties in extended mysqli classes don't work). (Georg) - Fixed bug #30922 (reflective functions crash PHP when interfaces extend themselves). (Tony, Dmitry) diff --git a/ext/standard/file.c b/ext/standard/file.c index 171d24a3be..bd3b402632 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -812,6 +812,14 @@ PHP_FUNCTION(popen) convert_to_string_ex(arg1); convert_to_string_ex(arg2); p = estrndup(Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2)); +#ifndef PHP_WIN32 + { + char *z = memchr(p, 'b', Z_STRLEN_PP(arg2)); + if (z) { + memmove(p + (z - p), z + 1, Z_STRLEN_PP(arg2) - (z - p)); + } + } +#endif if (PG(safe_mode)){ b = strchr(Z_STRVAL_PP(arg1), ' '); if (!b) {