Skip to content

Commit 47ccc3b

Browse files
Merge branch 'php:master' into exif_heif
2 parents 25308f6 + ba0f9fb commit 47ccc3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1754
-386
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ PHP NEWS
1818
- Curl:
1919
. Deprecated the CURLOPT_BINARYTRANSFER constant. (divinity76)
2020
. Bumped required libcurl version to 7.61.0. (Ayesh)
21+
. Added feature_list key to the curl_version() return value (Ayesh)
2122

2223
- Date:
2324
. Added DateTime[Immutable]::createFromTimestamp. (Marc Bennewitz)

UPGRADING

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ PHP 8.4 UPGRADE NOTES
252252

253253
- Curl:
254254
. The CURLOPT_BINARYTRANSFER constant is deprecated.
255+
. curl_version() returns an additional feature_list value, which is an
256+
associative array of all known Curl features, and whether they are
257+
supported (true) or not (false).
255258

256259
- Date:
257260
. Calling DatePeriod::__construct(string $isostr, int $options = 0) is

Zend/Optimizer/zend_func_infos.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,7 @@ static const func_info_t func_infos[] = {
517517
F1("sha1", MAY_BE_STRING),
518518
F1("sha1_file", MAY_BE_STRING|MAY_BE_FALSE),
519519
F1("inet_ntop", MAY_BE_STRING|MAY_BE_FALSE),
520-
#if defined(HAVE_INET_PTON)
521520
F1("inet_pton", MAY_BE_STRING|MAY_BE_FALSE),
522-
#endif
523521
F1("metaphone", MAY_BE_STRING),
524522
F1("headers_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
525523
F1("htmlspecialchars", MAY_BE_STRING),

Zend/zend.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,8 @@ void zend_shutdown(void) /* {{{ */
11831183
#endif
11841184
zend_destroy_rsrc_list_dtors();
11851185

1186+
zend_unload_modules();
1187+
11861188
zend_optimizer_shutdown();
11871189
startup_done = false;
11881190
}

Zend/zend.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ void zend_shutdown(void);
279279
void zend_register_standard_ini_entries(void);
280280
zend_result zend_post_startup(void);
281281
void zend_set_utility_values(zend_utility_values *utility_values);
282+
void zend_unload_modules(void);
282283

283284
ZEND_API ZEND_COLD ZEND_NORETURN void _zend_bailout(const char *filename, uint32_t lineno);
284285
ZEND_API size_t zend_get_page_size(void);

Zend/zend_API.c

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ ZEND_API HashTable module_registry;
4141
static zend_module_entry **module_request_startup_handlers;
4242
static zend_module_entry **module_request_shutdown_handlers;
4343
static zend_module_entry **module_post_deactivate_handlers;
44+
static zend_module_entry **modules_dl_loaded;
4445

4546
static zend_class_entry **class_cleanup_handlers;
4647

@@ -2398,6 +2399,7 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
23982399
int startup_count = 0;
23992400
int shutdown_count = 0;
24002401
int post_deactivate_count = 0;
2402+
int dl_loaded_count = 0;
24012403
zend_class_entry *ce;
24022404
int class_count = 0;
24032405

@@ -2412,6 +2414,9 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
24122414
if (module->post_deactivate_func) {
24132415
post_deactivate_count++;
24142416
}
2417+
if (module->handle) {
2418+
dl_loaded_count++;
2419+
}
24152420
} ZEND_HASH_FOREACH_END();
24162421
module_request_startup_handlers = (zend_module_entry**)realloc(
24172422
module_request_startup_handlers,
@@ -2424,6 +2429,9 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
24242429
module_request_shutdown_handlers[shutdown_count] = NULL;
24252430
module_post_deactivate_handlers = module_request_shutdown_handlers + shutdown_count + 1;
24262431
module_post_deactivate_handlers[post_deactivate_count] = NULL;
2432+
/* Cannot reuse module_request_startup_handlers because it is freed in zend_destroy_modules, which happens before zend_unload_modules. */
2433+
modules_dl_loaded = realloc(modules_dl_loaded, sizeof(zend_module_entry*) * (dl_loaded_count + 1));
2434+
modules_dl_loaded[dl_loaded_count] = NULL;
24272435
startup_count = 0;
24282436

24292437
ZEND_HASH_MAP_FOREACH_PTR(&module_registry, module) {
@@ -2436,6 +2444,9 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
24362444
if (module->post_deactivate_func) {
24372445
module_post_deactivate_handlers[--post_deactivate_count] = module;
24382446
}
2447+
if (module->handle) {
2448+
modules_dl_loaded[--dl_loaded_count] = module;
2449+
}
24392450
} ZEND_HASH_FOREACH_END();
24402451

24412452
/* Collect internal classes with static members */
@@ -3238,18 +3249,23 @@ void module_destructor(zend_module_entry *module) /* {{{ */
32383249
clean_module_functions(module);
32393250
}
32403251

3241-
#if HAVE_LIBDL
3242-
if (module->handle && !getenv("ZEND_DONT_UNLOAD_MODULES")) {
3243-
DL_UNLOAD(module->handle);
3244-
}
3245-
#endif
3246-
32473252
#if ZEND_RC_DEBUG
32483253
zend_rc_debug = orig_rc_debug;
32493254
#endif
32503255
}
32513256
/* }}} */
32523257

3258+
void module_registry_unload(const zend_module_entry *module)
3259+
{
3260+
#if HAVE_LIBDL
3261+
if (!getenv("ZEND_DONT_UNLOAD_MODULES")) {
3262+
DL_UNLOAD(module->handle);
3263+
}
3264+
#else
3265+
ZEND_IGNORE_VALUE(module);
3266+
#endif
3267+
}
3268+
32533269
ZEND_API void zend_activate_modules(void) /* {{{ */
32543270
{
32553271
zend_module_entry **p = module_request_startup_handlers;
@@ -3294,6 +3310,18 @@ ZEND_API void zend_deactivate_modules(void) /* {{{ */
32943310
}
32953311
/* }}} */
32963312

3313+
void zend_unload_modules(void) /* {{{ */
3314+
{
3315+
zend_module_entry **modules = modules_dl_loaded;
3316+
while (*modules) {
3317+
module_registry_unload(*modules);
3318+
modules++;
3319+
}
3320+
free(modules_dl_loaded);
3321+
modules_dl_loaded = NULL;
3322+
}
3323+
/* }}} */
3324+
32973325
ZEND_API void zend_post_deactivate_modules(void) /* {{{ */
32983326
{
32993327
if (EG(full_tables_cleanup)) {
@@ -3312,6 +3340,9 @@ ZEND_API void zend_post_deactivate_modules(void) /* {{{ */
33123340
break;
33133341
}
33143342
module_destructor(module);
3343+
if (module->handle) {
3344+
module_registry_unload(module);
3345+
}
33153346
zend_string_release_ex(key, 0);
33163347
} ZEND_HASH_MAP_FOREACH_END_DEL();
33173348
} else {

Zend/zend_modules.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ extern ZEND_API HashTable module_registry;
125125

126126
void module_destructor(zend_module_entry *module);
127127
int module_registry_request_startup(zend_module_entry *module);
128-
int module_registry_unload_temp(const zend_module_entry *module);
128+
void module_registry_unload(const zend_module_entry *module);
129129
END_EXTERN_C()
130130

131131
#endif

build/config.guess

100644100755
File mode changed.

build/config.sub

100644100755
File mode changed.

configure.ac

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ dnl ----------------------------------------------------------------------------
383383

384384
dnl QNX requires unix.h to allow functions in libunix to work properly.
385385
AC_CHECK_HEADERS([ \
386-
stdint.h \
387386
dirent.h \
388387
sys/param.h \
389388
sys/types.h \
@@ -398,7 +397,6 @@ grp.h \
398397
ieeefp.h \
399398
langinfo.h \
400399
linux/sock_diag.h \
401-
malloc.h \
402400
os/signpost.h \
403401
poll.h \
404402
pty.h \
@@ -603,7 +601,6 @@ getgrnam_r \
603601
getpwuid_r \
604602
getwd \
605603
glob \
606-
inet_pton \
607604
localtime_r \
608605
lchown \
609606
memcntl \
@@ -640,10 +637,8 @@ memrchr \
640637
mempcpy \
641638
)
642639

643-
AC_CHECK_FUNC(inet_ntop,[],[
644-
AC_MSG_ERROR([Cannot find inet_ntop which is required])
645-
]
646-
)
640+
AC_CHECK_FUNC([inet_ntop],,[AC_MSG_ERROR([Required inet_ntop not found.])])
641+
AC_CHECK_FUNC([inet_pton],,[AC_MSG_ERROR([Required inet_pton not found.])])
647642

648643
dnl Check for strerror_r, and if its a POSIX-compatible or a GNU specific version.
649644
AC_FUNC_STRERROR_R

0 commit comments

Comments
 (0)