]> granicus.if.org Git - php/commitdiff
Fixed bug #30990 (allow popen() on *NIX to accept 'b' flag).
authorIlia Alshanetsky <iliaa@php.net>
Mon, 6 Dec 2004 23:30:37 +0000 (23:30 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 6 Dec 2004 23:30:37 +0000 (23:30 +0000)
ext/standard/file.c

index e64aba0e8bee961be420540cc356d35afb7733ff..37a13ef0cd31a5715b05e85130b514d8c5905e06 100644 (file)
@@ -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) {