From 6883a3f09ce4724a25d1b0096f8ddf630ab05f5b Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 6 Dec 2004 23:30:37 +0000 Subject: [PATCH] Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag). --- ext/standard/file.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/standard/file.c b/ext/standard/file.c index e64aba0e8b..37a13ef0cd 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -834,6 +834,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) { -- 2.50.1