Skip to content

Commit 36f0d79

Browse files
committed
- MFH Compatibility with suhosin
1 parent 9b63c11 commit 36f0d79

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ext/phar/phar.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ static void destroy_phar_data(void *pDest) /* {{{ */
153153
phar_archive_data *phar_data = *(phar_archive_data **) pDest;
154154
TSRMLS_FETCH();
155155

156+
if (PHAR_GLOBALS->request_ends) {
157+
return destroy_phar_data_only(pDest);
158+
}
156159
zend_hash_apply_with_argument(&(PHAR_GLOBALS->phar_alias_map), phar_unalias_apply, phar_data TSRMLS_CC);
157160
if (--phar_data->refcount < 0) {
158161
phar_destroy_phar_data(phar_data TSRMLS_CC);
@@ -3126,6 +3129,7 @@ PHP_MSHUTDOWN_FUNCTION(phar) /* {{{ */
31263129
PHP_RINIT_FUNCTION(phar) /* {{{ */
31273130
{
31283131
PHAR_GLOBALS->request_done = 0;
3132+
PHAR_GLOBALS->request_ends = 0;
31293133
zend_hash_init(&(PHAR_GLOBALS->phar_fname_map), sizeof(phar_archive_data*), zend_get_hash_value, destroy_phar_data, 0);
31303134
zend_hash_init(&(PHAR_GLOBALS->phar_alias_map), sizeof(phar_archive_data*), zend_get_hash_value, NULL, 0);
31313135
return SUCCESS;
@@ -3134,8 +3138,8 @@ PHP_RINIT_FUNCTION(phar) /* {{{ */
31343138

31353139
PHP_RSHUTDOWN_FUNCTION(phar) /* {{{ */
31363140
{
3141+
PHAR_GLOBALS->request_ends = 1;
31373142
zend_hash_destroy(&(PHAR_GLOBALS->phar_alias_map));
3138-
PHAR_GLOBALS->phar_fname_map. pDestructor = destroy_phar_data_only;
31393143
zend_hash_destroy(&(PHAR_GLOBALS->phar_fname_map));
31403144
PHAR_GLOBALS->request_done = 1;
31413145
return SUCCESS;

ext/phar/phar_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phar)
103103
zend_bool readonly_orig;
104104
zend_bool require_hash_orig;
105105
int request_done;
106+
int request_ends;
106107
ZEND_END_MODULE_GLOBALS(phar)
107108

108109
ZEND_EXTERN_MODULE_GLOBALS(phar)

0 commit comments

Comments
 (0)