php.net |  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
 [2004-07-03 06:05 UTC] danielc at analysisandsolutions dot com
Description:
------------
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:
http://marc.theaimsgroup.com/?l=php-dev&m=108874256229775&w=2

Reproduce code:
---------------
<?php
exec('date', $Return);
exec('date', $Return);
print_r($Return);
?>


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

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-09 22:57 UTC] danielc at analysisandsolutions dot com
Curt Zirzow posted a patch for this to internals...
http://news.php.net/php.internals/10968
 [2004-07-13 02:46 UTC] curt@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC