From a031ced63bc1c0318e3dd13950a380e8c8e6f34c Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 15 May 2014 17:54:58 +0800 Subject: [PATCH 1/2] Fixed two tests, 1 left --- ext/xsl/php_xsl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c index 44efa2700c5..bda02498edc 100644 --- a/ext/xsl/php_xsl.c +++ b/ext/xsl/php_xsl.c @@ -115,6 +115,7 @@ zend_object *xsl_objects_new(zend_class_entry *class_type TSRMLS_DC) xsl_object *intern; intern = ecalloc(1, sizeof(xsl_object) + sizeof(zval) * (class_type->default_properties_count - 1)); + intern->securityPrefs = XSL_SECPREF_DEFAULT; zend_object_std_init(&intern->std, class_type TSRMLS_CC); object_properties_init(&intern->std, class_type); From bc99c0debb568741c1242f73be06c782a485e3e8 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 15 May 2014 14:00:49 +0400 Subject: [PATCH 2/2] Fixed hack. now we may store numbers not as pointers. --- ext/opcache/Optimizer/compact_literals.c | 28 ++++++++++++++---------- ext/opcache/Optimizer/zend_optimizer.c | 4 ++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index 8c562f887ae..80a75f5808d 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -90,7 +90,8 @@ static void optimizer_literal_class_info(literal_info *info, static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) { zend_op *opline, *end; - int i, j, n, pos, *map, cache_slots; + int i, j, n, *map, cache_slots; + zval zv, *pos; literal_info *info; int l_null = -1; int l_false = -1; @@ -323,11 +324,12 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) map[i] = l_true; break; case IS_LONG: - if ((pos = (int)zend_hash_index_find_ptr(&hash, Z_LVAL(op_array->literals[i]))) != 0) { - map[i] = pos - 1; + if ((pos = zend_hash_index_find(&hash, Z_LVAL(op_array->literals[i]))) != 0) { + map[i] = Z_LVAL_P(pos); } else { map[i] = j; - zend_hash_index_update_ptr(&hash, Z_LVAL(op_array->literals[i]), (void*)j + 1); + ZVAL_LONG(&zv, j); + zend_hash_index_update(&hash, Z_LVAL(op_array->literals[i]), &zv); if (i != j) { op_array->literals[j] = op_array->literals[i]; info[j] = info[i]; @@ -336,11 +338,12 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) } break; case IS_DOUBLE: - if ((pos = (int)zend_hash_str_find_ptr(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double))) != 0) { - map[i] = pos - 1; + if ((pos = zend_hash_str_find(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double))) != 0) { + map[i] = Z_LVAL_P(pos); } else { map[i] = j; - zend_hash_str_add_ptr(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double), (void*)j + 1); + ZVAL_LONG(&zv, j); + zend_hash_str_add(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double), &zv); if (i != j) { op_array->literals[j] = op_array->literals[i]; info[j] = info[i]; @@ -372,12 +375,12 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) key->h += info[i].flags; } if ((info[i].flags & LITERAL_MAY_MERGE) && - (pos = (int)zend_hash_find_ptr(&hash, key)) != 0 && - Z_TYPE(op_array->literals[i]) == Z_TYPE(op_array->literals[pos-1]) && - info[i].flags == info[pos-1].flags) { + (pos = zend_hash_find(&hash, key)) != 0 && + Z_TYPE(op_array->literals[i]) == Z_TYPE(op_array->literals[Z_LVAL_P(pos)]) && + info[i].flags == info[Z_LVAL_P(pos)].flags) { STR_RELEASE(key); - map[i] = pos - 1; + map[i] = Z_LVAL_P(pos); zval_dtor(&op_array->literals[i]); n = LITERAL_NUM_RELATED(info[i].flags); while (n > 1) { @@ -388,7 +391,8 @@ static void optimizer_compact_literals(zend_op_array *op_array TSRMLS_DC) } else { map[i] = j; if (info[i].flags & LITERAL_MAY_MERGE) { - zend_hash_add_ptr(&hash, key, (void*)j + 1); + ZVAL_LONG(&zv, j); + zend_hash_add(&hash, key, &zv); STR_RELEASE(key); } if (i != j) { diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index 2b6b07ca82a..602a63ec0b9 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -69,7 +69,7 @@ static int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name) (op_array->vars[i]->h == hash_value && op_array->vars[i]->len == name->len && memcmp(op_array->vars[i]->val, name->val, name->len) == 0)) { - return (int)EX_VAR_NUM_2(NULL, i); + return (int)(zend_intptr_t)EX_VAR_NUM_2(NULL, i); } i++; } @@ -100,7 +100,7 @@ static int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name) } } - return (int)EX_VAR_NUM_2(NULL, i); + return (int)(zend_intptr_t)EX_VAR_NUM_2(NULL, i); } #endif