|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28999 exec()'s output array overwritten
Submitted: 2004-07-03 06:05 UTC Modified: 2004-07-13 02:46 UTC
From: danielc at analysisandsolutions dot com Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 5CVS-2004-07-03 (dev) OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
44 - 7 = ?
Subscribe to this entry?

 [2004-07-03 06:05 UTC] danielc at analysisandsolutions dot com
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?

I made a post about this to internals:

Reproduce code:
exec('date', $Return);
exec('date', $Return);

Expected result:
    [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)

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-09 22:57 UTC] danielc at analysisandsolutions dot com
Curt Zirzow posted a patch for this to internals...
 [2004-07-13 02:46 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 22 13:01:29 2024 UTC