# exec()'s output array overwritten in PHP 5

- Thread: https://externals.io/message/10867
- Original archive: https://news-web.php.net/php.internals/10867
- Started by Daniel Convissor on 2004-07-02T04:29:20+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #10867 — Daniel Convissor — 2004-07-02T04:29:20+00:00

URL: https://externals.io/message/10867#10867

Hi:

In PHP 4, when using `exec()` multiple times with the same array in the 
"output" parameter, the data from subsequent `exec()` calls appended the new 
results to the existing array.  This is as the manual says.

When PHP 5 first came out, each call to `exec()` overwrote the prior array.  
At some point a while ago, there was discussion on the list and things 
were changed back to the old behavior.

At some point after that, the arrays started getting overwritten again.  
Is this intentional?

I saw no notices about it in README.PHP4-TO-PHP5-THIN-CHANGES or in the 
man page.

Can the old behavior be reimplemented in order to preserve compatibility?

Here's a test, if you're curious:

<?php
echo `phpversion()` . "\n";
exec('date', $Return);
exec('date', $Return);
print_r($Return);
?>

4.3.8-dev
Array
(
    [0] => The current date is: Fri 07/02/2004
    [1] => Enter the new date: (mm-dd-yy)
    [2] => The current date is: Fri 07/02/2004
    [3] => Enter the new date: (mm-dd-yy)
)

5.0.0-dev
Array
(
    [0] => The current date is: Fri 07/02/2004
    [1] => Enter the new date: (mm-dd-yy)
)

Thanks,

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409

---

## #10883 — Daniel Convissor — 2004-07-03T04:05:54+00:00

URL: https://externals.io/message/10867#10883 · In reply to: #10867

Hi:

Filed a bug about this: http://bugs.php.net/bug.php?id=28999

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409
