aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lang/php4/Makefile2
-rw-r--r--lang/php4/files/patch-ext::standard::php_var.h20
-rw-r--r--lang/php4/files/patch-ext::standard::var_unserializer.c87
-rw-r--r--lang/php5/Makefile2
-rw-r--r--lang/php5/files/patch-ext::standard::php_var.h20
-rw-r--r--lang/php5/files/patch-ext::standard::var_unserializer.c87
-rw-r--r--lang/php53/Makefile2
-rw-r--r--lang/php53/files/patch-ext::standard::php_var.h20
-rw-r--r--lang/php53/files/patch-ext::standard::var_unserializer.c87
9 files changed, 324 insertions, 3 deletions
diff --git a/lang/php4/Makefile b/lang/php4/Makefile
index a885f917f830..83aff60e01e9 100644
--- a/lang/php4/Makefile
+++ b/lang/php4/Makefile
@@ -7,7 +7,7 @@
PORTNAME= php4
PORTVERSION= 4.3.10
-PORTREVISION?= 1
+PORTREVISION?= 2
CATEGORIES?= lang devel www
MASTER_SITES= ${MASTER_SITE_PHP:S,$,:release,} \
http://downloads.php.net/ilia/:rc \
diff --git a/lang/php4/files/patch-ext::standard::php_var.h b/lang/php4/files/patch-ext::standard::php_var.h
new file mode 100644
index 000000000000..c3b01c3a9fd7
--- /dev/null
+++ b/lang/php4/files/patch-ext::standard::php_var.h
@@ -0,0 +1,20 @@
+--- ext/standard/php_var.h.orig 2004/09/05 16:29:04
++++ ext/standard/php_var.h 2005/01/15 18:18:08
+@@ -41,6 +41,7 @@ PHPAPI void php_debug_zval_dump(zval **s
+
+ struct php_unserialize_data {
+ void *first;
++ void *first_dtor;
+ };
+
+ typedef struct php_unserialize_data php_unserialize_data_t;
+@@ -54,7 +55,8 @@ PHPAPI int php_var_unserialize(zval **rv
+ zend_hash_destroy(&(var_hash))
+
+ #define PHP_VAR_UNSERIALIZE_INIT(var_hash) \
+- (var_hash).first = 0
++ (var_hash).first = 0; \
++ (var_hash).first_dtor = 0
+ #define PHP_VAR_UNSERIALIZE_DESTROY(var_hash) \
+ var_destroy(&(var_hash))
+
diff --git a/lang/php4/files/patch-ext::standard::var_unserializer.c b/lang/php4/files/patch-ext::standard::var_unserializer.c
new file mode 100644
index 000000000000..930becda86ed
--- /dev/null
+++ b/lang/php4/files/patch-ext::standard::var_unserializer.c
@@ -0,0 +1,87 @@
+--- ext/standard/var_unserializer.c.orig 2004/12/03 16:02:48
++++ ext/standard/var_unserializer.c 2005/01/18 10:57:05
+@@ -56,6 +56,30 @@ static inline void var_push(php_unserial
+ var_hash->data[var_hash->used_slots++] = *rval;
+ }
+
++static inline void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
++{
++ var_entries *var_hash = var_hashx->first_dtor, *prev = NULL;
++
++ while (var_hash && var_hash->used_slots == VAR_ENTRIES_MAX) {
++ prev = var_hash;
++ var_hash = var_hash->next;
++ }
++
++ if (!var_hash) {
++ var_hash = emalloc(sizeof(var_entries));
++ var_hash->used_slots = 0;
++ var_hash->next = 0;
++
++ if (!var_hashx->first_dtor)
++ var_hashx->first_dtor = var_hash;
++ else
++ prev->next = var_hash;
++ }
++
++ (*rval)->refcount++;
++ var_hash->data[var_hash->used_slots++] = *rval;
++}
++
+ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **nzval)
+ {
+ int i;
+@@ -93,6 +117,7 @@ static int var_access(php_unserialize_da
+ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
+ {
+ void *next;
++ int i;
+ var_entries *var_hash = var_hashx->first;
+
+ while (var_hash) {
+@@ -100,6 +125,17 @@ PHPAPI void var_destroy(php_unserialize_
+ efree(var_hash);
+ var_hash = next;
+ }
++
++ var_hash = var_hashx->first_dtor;
++
++ while (var_hash) {
++ for (i = 0; i < var_hash->used_slots; i++) {
++ zval_ptr_dtor(&var_hash->data[i]);
++ }
++ next = var_hash->next;
++ efree(var_hash);
++ var_hash = next;
++ }
+ }
+
+ /* }}} */
+@@ -177,7 +213,7 @@ static inline size_t parse_uiv(const uns
+ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, int elements)
+ {
+ while (elements-- > 0) {
+- zval *key, *data, *old_data;
++ zval *key, *data, **old_data;
+
+ ALLOC_INIT_ZVAL(key);
+
+@@ -205,14 +241,14 @@ static inline int process_nested_data(UN
+
+ switch (Z_TYPE_P(key)) {
+ case IS_LONG:
+- if (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)) {
+- var_replace(var_hash, old_data, rval);
++ if (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)==SUCCESS) {
++ var_push_dtor(var_hash, old_data);
+ }
+ zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);
+ break;
+ case IS_STRING:
+- if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)) {
+- var_replace(var_hash, old_data, rval);
++ if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
++ var_push_dtor(var_hash, old_data);
+ }
+ zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
+ break;
diff --git a/lang/php5/Makefile b/lang/php5/Makefile
index 7141875bf6de..f97d99be80dc 100644
--- a/lang/php5/Makefile
+++ b/lang/php5/Makefile
@@ -7,7 +7,7 @@
PORTNAME= php5
PORTVERSION= 5.0.3
-PORTREVISION?= 1
+PORTREVISION?= 2
CATEGORIES?= lang devel www
MASTER_SITES= ${MASTER_SITE_PHP:S,$,:release,} \
http://downloads.php.net/ilia/:rc \
diff --git a/lang/php5/files/patch-ext::standard::php_var.h b/lang/php5/files/patch-ext::standard::php_var.h
new file mode 100644
index 000000000000..c3b01c3a9fd7
--- /dev/null
+++ b/lang/php5/files/patch-ext::standard::php_var.h
@@ -0,0 +1,20 @@
+--- ext/standard/php_var.h.orig 2004/09/05 16:29:04
++++ ext/standard/php_var.h 2005/01/15 18:18:08
+@@ -41,6 +41,7 @@ PHPAPI void php_debug_zval_dump(zval **s
+
+ struct php_unserialize_data {
+ void *first;
++ void *first_dtor;
+ };
+
+ typedef struct php_unserialize_data php_unserialize_data_t;
+@@ -54,7 +55,8 @@ PHPAPI int php_var_unserialize(zval **rv
+ zend_hash_destroy(&(var_hash))
+
+ #define PHP_VAR_UNSERIALIZE_INIT(var_hash) \
+- (var_hash).first = 0
++ (var_hash).first = 0; \
++ (var_hash).first_dtor = 0
+ #define PHP_VAR_UNSERIALIZE_DESTROY(var_hash) \
+ var_destroy(&(var_hash))
+
diff --git a/lang/php5/files/patch-ext::standard::var_unserializer.c b/lang/php5/files/patch-ext::standard::var_unserializer.c
new file mode 100644
index 000000000000..930becda86ed
--- /dev/null
+++ b/lang/php5/files/patch-ext::standard::var_unserializer.c
@@ -0,0 +1,87 @@
+--- ext/standard/var_unserializer.c.orig 2004/12/03 16:02:48
++++ ext/standard/var_unserializer.c 2005/01/18 10:57:05
+@@ -56,6 +56,30 @@ static inline void var_push(php_unserial
+ var_hash->data[var_hash->used_slots++] = *rval;
+ }
+
++static inline void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
++{
++ var_entries *var_hash = var_hashx->first_dtor, *prev = NULL;
++
++ while (var_hash && var_hash->used_slots == VAR_ENTRIES_MAX) {
++ prev = var_hash;
++ var_hash = var_hash->next;
++ }
++
++ if (!var_hash) {
++ var_hash = emalloc(sizeof(var_entries));
++ var_hash->used_slots = 0;
++ var_hash->next = 0;
++
++ if (!var_hashx->first_dtor)
++ var_hashx->first_dtor = var_hash;
++ else
++ prev->next = var_hash;
++ }
++
++ (*rval)->refcount++;
++ var_hash->data[var_hash->used_slots++] = *rval;
++}
++
+ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **nzval)
+ {
+ int i;
+@@ -93,6 +117,7 @@ static int var_access(php_unserialize_da
+ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
+ {
+ void *next;
++ int i;
+ var_entries *var_hash = var_hashx->first;
+
+ while (var_hash) {
+@@ -100,6 +125,17 @@ PHPAPI void var_destroy(php_unserialize_
+ efree(var_hash);
+ var_hash = next;
+ }
++
++ var_hash = var_hashx->first_dtor;
++
++ while (var_hash) {
++ for (i = 0; i < var_hash->used_slots; i++) {
++ zval_ptr_dtor(&var_hash->data[i]);
++ }
++ next = var_hash->next;
++ efree(var_hash);
++ var_hash = next;
++ }
+ }
+
+ /* }}} */
+@@ -177,7 +213,7 @@ static inline size_t parse_uiv(const uns
+ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, int elements)
+ {
+ while (elements-- > 0) {
+- zval *key, *data, *old_data;
++ zval *key, *data, **old_data;
+
+ ALLOC_INIT_ZVAL(key);
+
+@@ -205,14 +241,14 @@ static inline int process_nested_data(UN
+
+ switch (Z_TYPE_P(key)) {
+ case IS_LONG:
+- if (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)) {
+- var_replace(var_hash, old_data, rval);
++ if (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)==SUCCESS) {
++ var_push_dtor(var_hash, old_data);
+ }
+ zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);
+ break;
+ case IS_STRING:
+- if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)) {
+- var_replace(var_hash, old_data, rval);
++ if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
++ var_push_dtor(var_hash, old_data);
+ }
+ zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
+ break;
diff --git a/lang/php53/Makefile b/lang/php53/Makefile
index 7141875bf6de..f97d99be80dc 100644
--- a/lang/php53/Makefile
+++ b/lang/php53/Makefile
@@ -7,7 +7,7 @@
PORTNAME= php5
PORTVERSION= 5.0.3
-PORTREVISION?= 1
+PORTREVISION?= 2
CATEGORIES?= lang devel www
MASTER_SITES= ${MASTER_SITE_PHP:S,$,:release,} \
http://downloads.php.net/ilia/:rc \
diff --git a/lang/php53/files/patch-ext::standard::php_var.h b/lang/php53/files/patch-ext::standard::php_var.h
new file mode 100644
index 000000000000..c3b01c3a9fd7
--- /dev/null
+++ b/lang/php53/files/patch-ext::standard::php_var.h
@@ -0,0 +1,20 @@
+--- ext/standard/php_var.h.orig 2004/09/05 16:29:04
++++ ext/standard/php_var.h 2005/01/15 18:18:08
+@@ -41,6 +41,7 @@ PHPAPI void php_debug_zval_dump(zval **s
+
+ struct php_unserialize_data {
+ void *first;
++ void *first_dtor;
+ };
+
+ typedef struct php_unserialize_data php_unserialize_data_t;
+@@ -54,7 +55,8 @@ PHPAPI int php_var_unserialize(zval **rv
+ zend_hash_destroy(&(var_hash))
+
+ #define PHP_VAR_UNSERIALIZE_INIT(var_hash) \
+- (var_hash).first = 0
++ (var_hash).first = 0; \
++ (var_hash).first_dtor = 0
+ #define PHP_VAR_UNSERIALIZE_DESTROY(var_hash) \
+ var_destroy(&(var_hash))
+
diff --git a/lang/php53/files/patch-ext::standard::var_unserializer.c b/lang/php53/files/patch-ext::standard::var_unserializer.c
new file mode 100644
index 000000000000..930becda86ed
--- /dev/null
+++ b/lang/php53/files/patch-ext::standard::var_unserializer.c
@@ -0,0 +1,87 @@
+--- ext/standard/var_unserializer.c.orig 2004/12/03 16:02:48
++++ ext/standard/var_unserializer.c 2005/01/18 10:57:05
+@@ -56,6 +56,30 @@ static inline void var_push(php_unserial
+ var_hash->data[var_hash->used_slots++] = *rval;
+ }
+
++static inline void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
++{
++ var_entries *var_hash = var_hashx->first_dtor, *prev = NULL;
++
++ while (var_hash && var_hash->used_slots == VAR_ENTRIES_MAX) {
++ prev = var_hash;
++ var_hash = var_hash->next;
++ }
++
++ if (!var_hash) {
++ var_hash = emalloc(sizeof(var_entries));
++ var_hash->used_slots = 0;
++ var_hash->next = 0;
++
++ if (!var_hashx->first_dtor)
++ var_hashx->first_dtor = var_hash;
++ else
++ prev->next = var_hash;
++ }
++
++ (*rval)->refcount++;
++ var_hash->data[var_hash->used_slots++] = *rval;
++}
++
+ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **nzval)
+ {
+ int i;
+@@ -93,6 +117,7 @@ static int var_access(php_unserialize_da
+ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
+ {
+ void *next;
++ int i;
+ var_entries *var_hash = var_hashx->first;
+
+ while (var_hash) {
+@@ -100,6 +125,17 @@ PHPAPI void var_destroy(php_unserialize_
+ efree(var_hash);
+ var_hash = next;
+ }
++
++ var_hash = var_hashx->first_dtor;
++
++ while (var_hash) {
++ for (i = 0; i < var_hash->used_slots; i++) {
++ zval_ptr_dtor(&var_hash->data[i]);
++ }
++ next = var_hash->next;
++ efree(var_hash);
++ var_hash = next;
++ }
+ }
+
+ /* }}} */
+@@ -177,7 +213,7 @@ static inline size_t parse_uiv(const uns
+ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, int elements)
+ {
+ while (elements-- > 0) {
+- zval *key, *data, *old_data;
++ zval *key, *data, **old_data;
+
+ ALLOC_INIT_ZVAL(key);
+
+@@ -205,14 +241,14 @@ static inline int process_nested_data(UN
+
+ switch (Z_TYPE_P(key)) {
+ case IS_LONG:
+- if (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)) {
+- var_replace(var_hash, old_data, rval);
++ if (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)==SUCCESS) {
++ var_push_dtor(var_hash, old_data);
+ }
+ zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);
+ break;
+ case IS_STRING:
+- if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)) {
+- var_replace(var_hash, old_data, rval);
++ if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
++ var_push_dtor(var_hash, old_data);
+ }
+ zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
+ break;