com php-src: Revert "Explicitly validate popen mode": ext/standard/file.c ext/standard/tests/file/popen_pclose_error.phpt

From: Date: Thu, 06 Aug 2020 19:53:13 +0000
Subject: com php-src: Revert "Explicitly validate popen mode": ext/standard/file.c ext/standard/tests/file/popen_pclose_error.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-112600@lists.php.net to get a copy of this message
Commit: 7c8467562d4bc6f04047c0a32a91c95042f60f34 Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 6 Aug 2020 21:53:13 +0200 Parents: 11274f53e7fb9d669d74c23aa7883f5f04d92094 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7c8467562d4bc6f04047c0a32a91c95042f60f34 Log: Revert "Explicitly validate popen mode" This reverts commit ab36540bddb63139c3da9a9da5e5feacdf7bf7bf. Causes a test failure on Windows. Changed paths: M ext/standard/file.c M ext/standard/tests/file/popen_pclose_error.phpt Diff: diff --git a/ext/standard/file.c b/ext/standard/file.c index 88ffba81029..98578376b00 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -930,18 +930,10 @@ PHP_FUNCTION(popen) char *z = memchr(posix_mode, 'b', mode_len); if (z) { memmove(z, z + 1, mode_len - (z - posix_mode)); - mode_len--; } } #endif - /* Musl only partially validates the mode. Manually check it to ensure consistent behavior. */ - if (mode_len != 1 || (*posix_mode != 'r' && *posix_mode != 'w')) { - php_error_docref2(NULL, command, posix_mode, E_WARNING, "Invalid mode"); - efree(posix_mode); - RETURN_FALSE; - } - fp = VCWD_POPEN(command, posix_mode); if (!fp) { php_error_docref2(NULL, command, posix_mode, E_WARNING, "%s", strerror(errno)); diff --git a/ext/standard/tests/file/popen_pclose_error.phpt b/ext/standard/tests/file/popen_pclose_error..phpt index 07132808701..2f05e7788d9 100644 --- a/ext/standard/tests/file/popen_pclose_error.phpt +++ b/ext/standard/tests/file/popen_pclose_error.phpt @@ -22,7 +22,7 @@ unlink($file_path."/popen.tmp"); --EXPECTF-- *** Testing for error conditions *** -Warning: popen(abc.txt,rw): Invalid mode in %s on line %d +Warning: popen(abc.txt,rw): %s on line %d bool(false) --- Done ---

« previous php.cvs (#112600) next »