com php-src: Fixed bug #70018 (exec does not strip all whitespace): NEWS ext/standard/exec.c ext/standard/tests/general_functions/bug 70018.phpt

From: Date: Wed, 08 Jul 2015 11:30:58 +0000
Subject: com php-src: Fixed bug #70018 (exec does not strip all whitespace): NEWS ext/standard/exec.c ext/standard/tests/general_functions/bug 70018.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87848@lists.php.net to get a copy of this message
Commit: da333bfbd8ed9820922957cea70a562454548d84 Author: Xinchen Hui <laruence@php.net> Wed, 8 Jul 2015 19:30:37 +0800 Parents: f9dc60f36f0c038cf4a77b096f76bea0ba438b18 94957a7091d2d87d3b75c8395a3a11a4fbecaea1 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=da333bfbd8ed9820922957cea70a562454548d84 Log: Fixed bug #70018 (exec does not strip all whitespace) Merge branch 'PHP-5.6' Conflicts: ext/standard/exec.c Bugs: https://bugs.php.net/70018 Changed paths: MM NEWS MM ext/standard/exec.c AA ext/standard/tests/general_functions/bug70018.phpt Diff: diff --cc NEWS index 53828b0,d4a4561..ceca8ad --- 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 55d777c,4764f4b..8dd0d5d --- 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 0000000,0000000..4862010 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-- ++<?php ++$output = array(); ++exec('/bin/echo -n -e "abc\f\n \n"',$output); ++var_dump($output); ++?> ++--EXPECT-- ++array(2) { ++ [0]=> ++ string(3) "abc" ++ [1]=> ++ string(0) "" ++}

« previous php.cvs (#87848) next »