Re: Bug #3867 Updated: Exec() no longer returns the command output line
| From: | Johan Ekenberg | Date: | Mon, 20 Mar 2000 11:12:36 +0000 |
| Subject: | Re: Bug #3867 Updated: Exec() no longer returns the command output line | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-17083@lists.php.net to get a copy of this message | ||
> fixed them explicitly fixed it or because some other change made the
> sympthoms not exhibit, but the bug is still there.
On feb 22, Andrei Zmievski made a fix for this bug in PHP4. Below is the
cvs-report.
/Johan Ekenberg
=========================================
andrei Tue Feb 22 10:01:02 2000 EDT
Modified files:
/php4/ext/standard exec.c
Log:
(PHP exec) Return last line of output properly.
Index: php4/ext/standard/exec.c
diff -u php4/ext/standard/exec.c:1.27 php4/ext/standard/exec.c:1.28
--- php4/ext/standard/exec.c:1.27 Sat Feb 19 15:41:20 2000
+++ php4/ext/standard/exec.c Tue Feb 22 10:00:32 2000
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.27 2000/02/19 23:41:20 zeev Exp $ */
+/* $Id: exec.c,v 1.28 2000/02/22 18:00:32 andrei Exp $ */
#include <stdio.h>
#include "php.h"
@@ -166,6 +166,14 @@
while (l && isspace((int)buf[--l]));
if (l < t) buf[l + 1] = '\0';
+ /* Return last line from the shell command */
+ if (PG(magic_quotes_runtime)) {
+ int len;
+
+ tmp = php_addslashes(buf, 0, &len, 0);
+ RETVAL_STRINGL(tmp,len,0);
+ } else
+ RETVAL_STRINGL(buf,l,1);
} else {
int b, i;
@@ -173,14 +181,6 @@
for (i = 0; i < b; i++)
if (output) (void)PUTC(buf[i]);
}
- }
-
- /* Return last line from the shell command */
- if (PG(magic_quotes_runtime) && type!=3) {
- int len;
-
- tmp = php_addslashes(buf, 0, &len, 0);
- RETVAL_STRINGL(tmp,len,0);
}
ret = pclose(fp);
=======================================