From: [EMAIL PROTECTED]
Operating system: solaris 2.6
PHP version: 4.0.4pl1
PHP Bug Type: Unknown/Other Function
Bug description: Patch for exec() - one character output doesn't work
When I exec() a program, and the program produces a single character as output (no
newline), the output does not make it back to PHP.
Here is a patch to fix the problem:
*** exec.c.orig Wed Jan 31 16:06:57 2001
--- exec.c Wed Jan 31 16:16:38 2001
***************
*** 163,170 ****
/* strip trailing spaces */
l = strlen(buf);
t = l;
! 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)) {
--- 163,172 ----
/* strip trailing spaces */
l = strlen(buf);
t = l;
! while (l && isspace((int)buf[l - 1])) {
! l--;
! }
! if (l < t) buf[l] = '\0';
/* Return last line from the shell command */
if (PG(magic_quotes_runtime)) {
***************
*** 173,179 ****
tmp = php_addslashes(buf, 0, &len, 0);
RETVAL_STRINGL(tmp,len,0);
} else {
! RETVAL_STRINGL(buf,l?l+1:0,1);
}
} else {
int b, i;
--- 175,181 ----
tmp = php_addslashes(buf, 0, &len, 0);
RETVAL_STRINGL(tmp,len,0);
} else {
! RETVAL_STRINGL(buf,l,1);
}
} else {
int b, i;
--
Edit Bug report at: http://bugs.php.net/?id=9042&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]