|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-02-22 18:47 UTC] sniper@php.net
[2001-04-28 09:21 UTC] elixer@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 06:00:02 2025 UTC |
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;