Bug #3915: exec() does not return last line as documented
| From: | zwerschke at urz dot uni-heidelberg dot de | Date: | Fri, 24 Mar 2000 13:13:31 +0000 |
| Subject: | Bug #3915: exec() does not return last line as documented | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-17197@lists.php.net to get a copy of this message | ||
From: zwerschke@urz.uni-heidelberg.de
Operating system: Solaris 7
PHP version: 3.0.15
PHP Bug Type: Misbehaving function
Bug description: exec() does not return last line as documented
The exec() function does not return the last line from the result of the command as documented (see
also Bug #3795), the function system() has the same problem.
As far as I understand there is a bug in functions/exec.c
The code for returning the last line should be changed
to be something like this (I tried it and it works):
/* Return last line from the shell command */
if (type!=3) {
if (php3_ini.magic_quotes_runtime) {
int len;
tmp = _php3_addslashes(buf, 0, &len, 0);
RETVAL_STRINGL(tmp,len,0);
} else {
RETVAL_STRING(buf,1);
}
}