mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Destroy temporary module classes in reverse order
This commit is contained in:
commit
4b9c72f329
5 changed files with 84 additions and 14 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "zend.h"
|
||||
#include "zend_execute.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_hash.h"
|
||||
#include "zend_modules.h"
|
||||
#include "zend_extensions.h"
|
||||
#include "zend_constants.h"
|
||||
|
@ -3263,21 +3264,17 @@ ZEND_API zend_result zend_get_module_started(const char *module_name) /* {{{ */
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
static int clean_module_class(zval *el, void *arg) /* {{{ */
|
||||
{
|
||||
zend_class_entry *ce = (zend_class_entry *)Z_PTR_P(el);
|
||||
int module_number = *(int *)arg;
|
||||
if (ce->type == ZEND_INTERNAL_CLASS && ce->info.internal.module->module_number == module_number) {
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
} else {
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void clean_module_classes(int module_number) /* {{{ */
|
||||
{
|
||||
zend_hash_apply_with_argument(EG(class_table), clean_module_class, (void *) &module_number);
|
||||
/* Child classes may reuse structures from parent classes, so destroy in reverse order. */
|
||||
Bucket *bucket;
|
||||
ZEND_HASH_REVERSE_FOREACH_BUCKET(EG(class_table), bucket) {
|
||||
zend_class_entry *ce = Z_CE(bucket->val);
|
||||
if (ce->type == ZEND_INTERNAL_CLASS && ce->info.internal.module->module_number == module_number) {
|
||||
zend_hash_del_bucket(EG(class_table), bucket);
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue