patch for bug #28999
| From: | Curt Zirzow | Date: | Thu, 08 Jul 2004 05:32:08 +0000 |
| Subject: | patch for bug #28999 | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-10968@lists.php.net to get a copy of this message | ||
http://bugs.php.net/28999
It seems the behaviour of exec() and the array being returned
changed when iliaa revamped a lot of code pre 4_3_2RC1, which caused the
array being passed to always get initialized.
So it does seem questionable if it should be refixed since this
behaviour has been around for a while.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
Index: exec.c =================================================================== RCS file: /repository/php-src/ext/standard/exec.c,v retrieving revision 1.110 diff -u -r1.110 exec.c --- exec.c 18 May 2004 13:43:24 -0000 1.110 +++ exec.c 8 Jul 2004 05:18:38 -0000 @@ -213,8 +213,10 @@ if (!ret_array) { ret = php_exec(mode, cmd, NULL, return_value TSRMLS_CC); } else { - zval_dtor(ret_array); - array_init(ret_array); + if (Z_TYPE_P(ret_array) != IS_ARRAY) { + pval_destructor(ret_array); + array_init(ret_array); + } ret = php_exec(2, cmd, ret_array, return_value TSRMLS_CC); } if (ret_code) {
Index: exec.c =================================================================== RCS file: /repository/php-src/ext/standard/exec.c,v retrieving revision 1.110 diff -u -r1.110 exec.c --- exec.c 18 May 2004 13:43:24 -0000 1.110 +++ exec.c 8 Jul 2004 05:18:38 -0000 @@ -213,8 +213,10 @@ if (!ret_array) { ret = php_exec(mode, cmd, NULL, return_value TSRMLS_CC); } else { - zval_dtor(ret_array); - array_init(ret_array); + if (Z_TYPE_P(ret_array) != IS_ARRAY) { + pval_destructor(ret_array); + array_init(ret_array); + } ret = php_exec(2, cmd, ret_array, return_value TSRMLS_CC); } if (ret_code) {