From d059006b671390fc0b13a9e73265ce9fdc63e65a Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 6 Dec 2004 23:31:58 +0000 Subject: [PATCH] MFH: Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag). --- NEWS | 1 + ext/standard/file.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/NEWS b/NEWS index df4c223509..a55590a1d0 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Nov 2004, Version 4.3.10 +- Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag). 23 Nov 2004, Version 4.3.10RC1 - Added the %F modifier to *printf to render a non-locale-aware representation diff --git a/ext/standard/file.c b/ext/standard/file.c index 435d61dfaf..fdbe22568c 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1198,6 +1198,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