php/php-5.3.2-gc.patch
2010-04-30 05:10:45 +00:00

170 lines
5.7 KiB
Diff

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: