dmitry Mon Feb 9 10:47:09 2009 UTC
Modified files: (Branch: PHP_5_3)
/php-src NEWS
/php-src/ext/standard array.c
Log:
Fixed bug #47329 (Crash in garbage collector)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.488&r2=1.2027.2.547.2.965.2.489&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.488
php-src/NEWS:1.2027.2.547.2.965.2.489
--- php-src/NEWS:1.2027.2.547.2.965.2.488 Mon Feb 9 09:20:34 2009
+++ php-src/NEWS Mon Feb 9 10:47:08 2009
@@ -1,6 +1,7 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2009, PHP 5.3.0 Beta 2
+- Fixed bug #47329 (Crash in garbage collector). (Dmitry)
- Fixed bug #47320 ($php_errormsg out of scope in functions). (Dmitry)
- Fixed bug #47265 (generating phar.phar failes because of safe_mode). (Greg)
- Fixed bug #47229 (preg_quote() should escape the '-' char). (Nuno)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.37.2.50&r2=1.308.2.21.2.37.2.51&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.37.2.50
php-src/ext/standard/array.c:1.308.2.21.2.37.2.51
--- php-src/ext/standard/array.c:1.308.2.21.2.37.2.50 Wed Dec 31 11:15:44 2008
+++ php-src/ext/standard/array.c Mon Feb 9 10:47:09 2009
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.308.2.21.2.37.2.50 2008/12/31 11:15:44 sebastian Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.37.2.51 2009/02/09 10:47:09 dmitry Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -1965,6 +1965,7 @@
zval ***args, /* Function arguments array */
*stack; /* Input stack */
HashTable *new_hash; /* New hashtable for the stack */
+ HashTable old_hash;
int argc; /* Number of function arguments
*/
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a+", &stack,
&args, &argc) == FAILURE) {
@@ -1974,12 +1975,13 @@
/* Use splice to insert the elements at the beginning. Destroy old
* hashtable and replace it with new one */
new_hash = php_splice(Z_ARRVAL_P(stack), 0, 0, &args[0], argc, NULL);
- zend_hash_destroy(Z_ARRVAL_P(stack));
+ old_hash = *Z_ARRVAL_P(stack);
if (Z_ARRVAL_P(stack) == &EG(symbol_table)) {
zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC);
}
*Z_ARRVAL_P(stack) = *new_hash;
FREE_HASHTABLE(new_hash);
+ zend_hash_destroy(&old_hash);
/* Clean up and return the number of elements in the stack */
efree(args);
@@ -1996,6 +1998,7 @@
***repl = NULL; /* Replacement elements */
HashTable *new_hash = NULL, /* Output array's hash */
**rem_hash = NULL; /* Removed elements' hash */
+ HashTable old_hash;
Bucket *p; /* Bucket used for
traversing hash */
long i,
offset,
@@ -2053,12 +2056,13 @@
new_hash = php_splice(Z_ARRVAL_P(array), offset, length, repl,
repl_num, rem_hash);
/* Replace input array's hashtable with the new one */
- zend_hash_destroy(Z_ARRVAL_P(array));
+ old_hash = *Z_ARRVAL_P(array);
if (Z_ARRVAL_P(array) == &EG(symbol_table)) {
zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC);
}
*Z_ARRVAL_P(array) = *new_hash;
FREE_HASHTABLE(new_hash);
+ zend_hash_destroy(&old_hash);
/* Clean up */
if (ZEND_NUM_ARGS() == 4) {
@@ -2532,6 +2536,7 @@
zval *pad_value; /* Padding value obviously */
zval ***pads; /* Array to pass to splice */
HashTable *new_hash;/* Return value from splice */
+ HashTable old_hash;
long pad_size; /* Size to pad to */
long pad_size_abs; /* Absolute value of pad_size */
int input_size; /* Size of the input array */
@@ -2581,12 +2586,13 @@
}
/* Copy the result hash into return value */
- zend_hash_destroy(Z_ARRVAL_P(return_value));
+ old_hash = *Z_ARRVAL_P(return_value);
if (Z_ARRVAL_P(return_value) == &EG(symbol_table)) {
zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC);
}
*Z_ARRVAL_P(return_value) = *new_hash;
FREE_HASHTABLE(new_hash);
+ zend_hash_destroy(&old_hash);
/* Clean up */
efree(pads);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php