Skip to content

Commit e44b1a9

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Destroy file_handle in fpm_main
2 parents d479b5a + f30e71c commit e44b1a9

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ PHP NEWS
2424

2525
- FPM:
2626
. Fixed bug GH-10611 (fpm_env_init_main leaks environ). (nielsdos)
27+
. Destroy file_handle in fpm_main. (Jakub Zelenka, nielsdos)
2728

2829
- FTP:
2930
. Propagate success status of ftp_close(). (nielsdos)

sapi/fpm/fpm/fpm_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,13 @@ consult the installation file that came with this distribution, or visit \n\
19031903

19041904
php_execute_script(&file_handle);
19051905

1906+
/* Without opcache, or the first time with opcache, the file handle will be placed
1907+
* in the CG(open_files) list by open_file_for_scanning(). Starting from the second
1908+
* request in opcache, the file handle won't be in the list and therefore won't be destroyed for us. */
1909+
if (!file_handle.in_list) {
1910+
zend_destroy_file_handle(&file_handle);
1911+
}
1912+
19061913
fastcgi_request_done:
19071914
if (EXPECTED(primary_script)) {
19081915
efree(primary_script);

0 commit comments

Comments
 (0)