garbage collector upstream patches (#580236)

This commit is contained in:
Remi Collet 2010-04-30 05:10:45 +00:00
parent 83b7045a6e
commit d324eefdcb
2 changed files with 176 additions and 1 deletions

169
php-5.3.2-gc.patch Normal file
View File

@ -0,0 +1,169 @@
Fixes garbage collector bugs, see
- http://svn.php.net/viewvc?view=revision&revision=297307
- http://svn.php.net/viewvc?view=revision&revision=298213
- http://svn.php.net/viewvc?view=revision&revision=298253
--- php/php-src/branches/PHP_5_3/Zend/zend_gc.c 2010/04/01 21:23:02 297306
+++ php/php-src/branches/PHP_5_3/Zend/zend_gc.c 2010/04/01 22:54:03 297307
@@ -282,7 +282,11 @@
GC_SET_BLACK(obj->buffered);
if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid &&
Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) {
- p = Z_OBJPROP_P(pz)->pListHead;
+ HashTable *props = Z_OBJPROP_P(pz);
+ if(!props) {
+ return;
+ }
+ p = props->pListHead;
}
}
} else if (Z_TYPE_P(pz) == IS_ARRAY) {
@@ -313,7 +317,11 @@
GC_SET_BLACK(obj->buffered);
if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid &&
Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) {
- p = Z_OBJPROP_P(pz)->pListHead;
+ HashTable *props = Z_OBJPROP_P(pz);
+ if(!props) {
+ return;
+ }
+ p = props->pListHead;
while (p != NULL) {
pz = *(zval**)p->pData;
if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) {
@@ -346,7 +354,11 @@
GC_SET_COLOR(obj->buffered, GC_GREY);
if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid &&
Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) {
- p = Z_OBJPROP_P(pz)->pListHead;
+ HashTable *props = Z_OBJPROP_P(pz);
+ if(!props) {
+ return;
+ }
+ p = props->pListHead;
}
}
} else if (Z_TYPE_P(pz) == IS_ARRAY) {
@@ -380,7 +392,11 @@
GC_SET_COLOR(obj->buffered, GC_GREY);
if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid &&
Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) {
- p = Z_OBJPROP_P(pz)->pListHead;
+ HashTable *props = Z_OBJPROP_P(pz);
+ if(!props) {
+ return;
+ }
+ p = props->pListHead;
while (p != NULL) {
pz = *(zval**)p->pData;
if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) {
@@ -445,7 +461,11 @@
GC_SET_COLOR(obj->buffered, GC_WHITE);
if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid &&
Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) {
- p = Z_OBJPROP_P(pz)->pListHead;
+ HashTable *props = Z_OBJPROP_P(pz);
+ if(!props) {
+ return 0;
+ }
+ p = props->pListHead;
}
}
}
@@ -484,7 +504,11 @@
GC_SET_COLOR(obj->buffered, GC_WHITE);
if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid &&
Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) {
- p = Z_OBJPROP_P(pz)->pListHead;
+ HashTable *props = Z_OBJPROP_P(pz);
+ if(!props) {
+ return;
+ }
+ p = props->pListHead;
while (p != NULL) {
zval_scan(*(zval**)p->pData TSRMLS_CC);
p = p->pListNext;
@@ -531,7 +555,11 @@
if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid &&
Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) {
- p = Z_OBJPROP_P(pz)->pListHead;
+ HashTable *props = Z_OBJPROP_P(pz);
+ if(!props) {
+ return;
+ }
+ p = props->pListHead;
}
}
} else {
@@ -572,7 +600,11 @@
if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid &&
Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) {
- p = Z_OBJPROP_P(pz)->pListHead;
+ HashTable *props = Z_OBJPROP_P(pz);
+ if(!props) {
+ return;
+ }
+ p = props->pListHead;
while (p != NULL) {
pz = *(zval**)p->pData;
if (Z_TYPE_P(pz) != IS_ARRAY || Z_ARRVAL_P(pz) != &EG(symbol_table)) {
--- php/php-src/branches/PHP_5_3/Zend/zend_execute.c 2010/04/20 12:26:15 298212
+++ php/php-src/branches/PHP_5_3/Zend/zend_execute.c 2010/04/20 12:30:35 298213
@@ -708,6 +708,7 @@
return variable_ptr;
}
} else { /* we need to split */
+ GC_ZVAL_CHECK_POSSIBLE_ROOT(*variable_ptr_ptr);
if (!is_tmp_var) {
if (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) {
ALLOC_ZVAL(variable_ptr);
--- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2010/04/21 12:13:49 298252
+++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2010/04/21 12:52:24 298253
@@ -1663,13 +1663,13 @@
{
MY_MYSQL *mysql;
zval *mysql_link = NULL;
- zval *mysql_value;
+ zval **mysql_value;
long mysql_option;
unsigned int l_value;
long ret;
int expected_type;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OlZ", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_INITIALIZED);
@@ -1680,13 +1680,13 @@
}
}
expected_type = mysqli_options_get_option_zval_type(mysql_option);
- if (expected_type != Z_TYPE_P(mysql_value)) {
+ if (expected_type != Z_TYPE_PP(mysql_value)) {
switch (expected_type) {
case IS_STRING:
- convert_to_string_ex(&mysql_value);
+ convert_to_string_ex(mysql_value);
break;
case IS_LONG:
- convert_to_long_ex(&mysql_value);
+ convert_to_long_ex(mysql_value);
break;
default:
break;
@@ -1694,10 +1694,10 @@
}
switch (expected_type) {
case IS_STRING:
- ret = mysql_options(mysql->mysql, mysql_option, Z_STRVAL_PP(&mysql_value));
+ ret = mysql_options(mysql->mysql, mysql_option, Z_STRVAL_PP(mysql_value));
break;
case IS_LONG:
- l_value = Z_LVAL_PP(&mysql_value);
+ l_value = Z_LVAL_PP(mysql_value);
ret = mysql_options(mysql->mysql, mysql_option, (char *)&l_value);
break;
default:

View File

@ -17,7 +17,7 @@
Summary: PHP scripting language for creating dynamic web sites
Name: php
Version: 5.3.2
Release: 2%{?dist}
Release: 3%{?dist}
License: PHP
Group: Development/Languages
URL: http://www.php.net/
@ -38,6 +38,7 @@ Patch7: php-5.3.0-recode.patch
Patch8: php-5.3.2-aconf26x.patch
# http://bugs.php.net/50578
Patch9: php-5.3.2-phar.patch
Patch10: php-5.3.2-gc.patch
# Fixes for extension modules
Patch20: php-4.3.11-shutdown.patch
@ -436,6 +437,7 @@ support for using the enchant library to PHP.
%patch7 -p1 -b .recode
%patch8 -p1 -b .aconf26x
%patch9 -p1 -b .shebang
%patch10 -p4 -b .gc
%patch20 -p1 -b .shutdown
%patch21 -p1 -b .macropen
@ -851,6 +853,7 @@ rm files.* macros.php
%files xmlrpc -f files.xmlrpc
%files mbstring -f files.mbstring
%files gd -f files.gd
%defattr(-,root,root,-)
%doc gd_README
%files soap -f files.soap
%files bcmath -f files.bcmath
@ -867,6 +870,9 @@ rm files.* macros.php
%files enchant -f files.enchant
%changelog
* Fri Apr 30 2010 Remi Collet <Fedora@famillecollet.com> 5.3.2-3
- garbage collector upstream patches (#580236)
* Fri Apr 02 2010 Caolán McNamara <caolanm@redhat.com> 5.3.2-2
- rebuild for icu 4.4