pajoye                                   Wed, 03 Feb 2010 18:11:24 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=294429

Log:
- merge: Fixed bug #50732 (exec() adds single byte twice to  array).

Bug: http://bugs.php.net/50732 (Closed) exec() adds single byte twice to 
$output array
      
Changed paths:
    _U  php/php-src/branches/PHP_5_3_2/
    U   php/php-src/branches/PHP_5_3_2/ext/standard/exec.c
    A + 
php/php-src/branches/PHP_5_3_2/ext/standard/tests/general_functions/bug49847.phpt
        (from 
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug49847.phpt:r293502)
    A + 
php/php-src/branches/PHP_5_3_2/ext/standard/tests/general_functions/bug50732.phpt
        (from 
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug50732.phpt:r293502)
    _U  php/php-src/branches/PHP_5_3_2/ext/tidy/tests/
    _U  
php/php-src/branches/PHP_5_3_2/tests/security/open_basedir_parse_ini_file.phpt

Property changes on: php/php-src/branches/PHP_5_3_2
___________________________________________________________________
Modified: svn:mergeinfo
   - /php/php-src/branches/PHP_5_3:292504,292574,292594-292595,292611,292624,292630,292632-292635,292654,292677,292682-292683,292693,292719,292762,292765,292771,292777,292823,293051,293075,293114,293126,293131,293144,293268,293341,293400,293974
/php/php-src/trunk:284726
   + /php/php-src/branches/PHP_5_3:292504,292574,292594-292595,292611,292624,292630,292632-292635,292654,292677,292682-292683,292693,292719,292762,292765,292771,292777,292823,293051,293075,293114,293126,293131,293144,293268,293341,293400,293502,293974
/php/php-src/trunk:284726

Modified: php/php-src/branches/PHP_5_3_2/ext/standard/exec.c
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/standard/exec.c	2010-02-03 18:08:05 UTC (rev 294428)
+++ php/php-src/branches/PHP_5_3_2/ext/standard/exec.c	2010-02-03 18:11:24 UTC (rev 294429)
@@ -121,7 +121,7 @@

 	if (type != 3) {
 		b = buf;
-
+
 		while (php_stream_get_line(stream, b, EXEC_INPUT_BUF, &bufl)) {
 			/* no new line found, let's read some more */
 			if (b[bufl - 1] != '\n' && !php_stream_eof(stream)) {
@@ -157,7 +157,7 @@
 		}
 		if (bufl) {
 			/* strip trailing whitespaces if we have not done so already */
-			if ((type == 2 && bufl && !l) || type != 2) {
+			if ((type == 2 && buf != b) || type != 2) {
 				l = bufl;
 				while (l-- && isspace(((unsigned char *)buf)[l]));
 				if (l != (int)(bufl - 1)) {

Copied: php/php-src/branches/PHP_5_3_2/ext/standard/tests/general_functions/bug49847.phpt (from rev 293502, php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug49847.phpt)
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/standard/tests/general_functions/bug49847.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3_2/ext/standard/tests/general_functions/bug49847.phpt	2010-02-03 18:11:24 UTC (rev 294429)
@@ -0,0 +1,36 @@
+--TEST--
+Bug #49847 (exec() fails on lines larger then 4095 bytes)
+--FILE--
+<?php
+exec("printf %4098d 1", $output);
+var_dump($output);
+?>
+--EXPECT--
+array(1) {
+  [0]=>
+  string(4098) "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 1"
+}
+--TEST--
+Bug #49847 (exec() fails on lines larger then 4095 bytes)
+--FILE--
+<?php
+exec("printf %4098d 1", $output);
+var_dump($output);
+?>
+--EXPECT--
+array(1) {
+  [0]=>
+  string(4098) "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 1"
+}
+--TEST--
+Bug #49847 (exec() fails on lines larger then 4095 bytes)
+--FILE--
+<?php
+exec("printf %4098d 1", $output);
+var_dump($output);
+?>
+--EXPECT--
+array(1) {
+  [0]=>
+  string(4098) "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 1"
+}

Copied: php/php-src/branches/PHP_5_3_2/ext/standard/tests/general_functions/bug50732.phpt (from rev 293502, php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug50732.phpt)
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/standard/tests/general_functions/bug50732.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3_2/ext/standard/tests/general_functions/bug50732.phpt	2010-02-03 18:11:24 UTC (rev 294429)
@@ -0,0 +1,36 @@
+--TEST--
+Bug #50732 (exec() adds single byte twice to $output array)
+--FILE--
+<?php
+exec("echo x", $output);
+var_dump($output);
+?>
+--EXPECT--
+array(1) {
+  [0]=>
+  string(1) "x"
+}
+--TEST--
+Bug #50732 (exec() adds single byte twice to $output array)
+--FILE--
+<?php
+exec("echo x", $output);
+var_dump($output);
+?>
+--EXPECT--
+array(1) {
+  [0]=>
+  string(1) "x"
+}
+--TEST--
+Bug #50732 (exec() adds single byte twice to $output array)
+--FILE--
+<?php
+exec("echo x", $output);
+var_dump($output);
+?>
+--EXPECT--
+array(1) {
+  [0]=>
+  string(1) "x"
+}


Property changes on: php/php-src/branches/PHP_5_3_2/ext/tidy/tests
___________________________________________________________________
Modified: svn:mergeinfo
   - /php/php-src/branches/PHP_5_3/ext/tidy/tests:292562,292566,292571,292574,292635,292719,292765,293400
/php/php-src/trunk/ext/tidy/tests:284726,287798-287941
   + /php/php-src/branches/PHP_5_3/ext/tidy/tests:292562,292566,292571,292574,292635,292719,292765,293400,293502
/php/php-src/trunk/ext/tidy/tests:284726,287798-287941


Property changes on: php/php-src/branches/PHP_5_3_2/tests/security/open_basedir_parse_ini_file.phpt
___________________________________________________________________
Modified: svn:mergeinfo
   - /php/php-src/branches/PHP_5_3/tests/security/open_basedir_parse_ini_file.phpt:292562,292566,292571,292574,293400
/php/php-src/trunk/tests/security/open_basedir_parse_ini_file.phpt:265951
   + /php/php-src/branches/PHP_5_3/tests/security/open_basedir_parse_ini_file.phpt:292562,292566,292571,292574,293400,293502
/php/php-src/trunk/tests/security/open_basedir_parse_ini_file.phpt:265951
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to