From: Xinchen Hui Date: Wed, 8 Jul 2015 11:30:37 +0000 (+0800) Subject: Fixed bug #70018 (exec does not strip all whitespace) X-Git-Tag: php-7.1.1RC1~35^2~62 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da333bfbd8ed9820922957cea70a562454548d84;p=php Fixed bug #70018 (exec does not strip all whitespace) Merge branch 'PHP-5.6' Conflicts: ext/standard/exec.c --- da333bfbd8ed9820922957cea70a562454548d84 diff --cc NEWS index 53828b0e81,d4a4561150..ceca8ad4c9 --- a/NEWS +++ b/NEWS @@@ -5,24 -5,6 +5,27 @@@ - Core: . Fixed bug #70012 (Exception lost with nested finally block). (Laruence) ++- Standard: ++ . Fixed bug #70018 (exec does not strip all whitespace). (Laruence) ++ +09 Jul 2015, PHP 7.0.0 Beta 1 + +- Core: + . Fixed bug #70006 (cli - function with default arg = STDOUT crash output). + (Laruence) + . Fixed bug #69521 (Segfault in gc_collect_cycles()). + (arjen at react dot com, Laruence) + . Improved zend_string API (Francois Laupretre) + . Fixed bug #69955 (Segfault when trying to combine [] and assign-op on + ArrayAccess object). (Laruence) + . Fixed bug #69957 (Different ways of handling div/mod/intdiv). (Bob) + . Fixed bug #69900 (Too long timeout on pipes). (Anatol) + . Fixed bug #62210 (Exceptions can leak temporary variables. As a part of + the fix serious refactoring was done. op_array->brk_cont_array was removed, + and replaced with more general and speed efficient op_array->T_liveliness. + ZEND_GOTO opcode is always replaced by ZEND_JMP at compile time). + (Bob, Dmitry, Laruence) + - CLI server: . Fixed bug #69655 (php -S changes MKCALENDAR request method to MKCOL). (cmb) . Fixed bug #64878 (304 responses return Content-Type header). (cmb) diff --cc ext/standard/exec.c index 55d777cb92,4764f4bf33..8dd0d5dfd7 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@@ -116,8 -115,8 +116,8 @@@ PHPAPI int php_exec(int type, char *cmd } else if (type == 2) { /* strip trailing whitespaces */ l = bufl; - while (l >= 1 && l-- && isspace(((unsigned char *)buf)[l])); - while (--l >= 0 && isspace(((unsigned char *)buf)[l])); - if (l != (int)(bufl - 1)) { ++ while (l-- > 0 && isspace(((unsigned char *)buf)[l])); + if (l != (bufl - 1)) { bufl = l + 1; buf[bufl] = '\0'; } @@@ -129,8 -128,8 +129,8 @@@ /* strip trailing whitespaces if we have not done so already */ if ((type == 2 && buf != b) || type != 2) { l = bufl; - while (l >= 1 && l-- && isspace(((unsigned char *)buf)[l])); - while (--l >= 0 && isspace(((unsigned char *)buf)[l])); - if (l != (int)(bufl - 1)) { ++ while (l-- > 0 && isspace(((unsigned char *)buf)[l])); + if (l != (bufl - 1)) { bufl = l + 1; buf[bufl] = '\0'; } diff --cc ext/standard/tests/general_functions/bug70018.phpt index 0000000000,0000000000..4862010a31 new file mode 100644 --- /dev/null +++ b/ext/standard/tests/general_functions/bug70018.phpt @@@ -1,0 -1,0 +1,15 @@@ ++--TEST-- ++Bug #70018 (exec does not strip all whitespace) ++--FILE-- ++ ++--EXPECT-- ++array(2) { ++ [0]=> ++ string(3) "abc" ++ [1]=> ++ string(0) "" ++}