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

diff --git a/NEWS b/NEWS
index f48838fcf4dc34f58f73bd36f77aa86503245568..c62741ff86786c898acdc7c6736184d7347caeba 100644 (file)
--- 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)
index 171d24a3be83e8c5ae77f74a5e848e803be215ad..bd3b40263282b87a98f402d465ae6e11f1c1f5fb 100644 (file)
@@ -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) {