Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fpm进程中存在多个application.ini文件句柄 #585

Closed
albertttang opened this issue Sep 21, 2023 · 3 comments
Closed

fpm进程中存在多个application.ini文件句柄 #585

albertttang opened this issue Sep 21, 2023 · 3 comments

Comments

@albertttang
Copy link

albertttang commented Sep 21, 2023

application.ini 路径相同,文件句柄一直没有释放,请教下是否正常?入口文件代码如下:

<?php define('APP_PATH', realpath(dirname(__FILE__).'/../')); $app = new Yaf_Application(APP_PATH."/conf/application.ini"); $app->bootstrap(); $app->run();

image

@scott-pb
Copy link

scott-pb commented Oct 10, 2023

image

打开一个文件将fd赋值给 zend_file_handle fh
zend_stream_init_fp(&fh, VCWD_FOPEN(ini_file, "r"), ini_file);

这个宏定义 是打开一个文件
#define VCWD_FOPEN(path, mode) fopen(path, mode)

ZEND_API void zend_stream_init_fp(zend_file_handle *handle, FILE *fp, const char *filename) {
memset(handle, 0, sizeof(zend_file_handle));
handle->type = ZEND_HANDLE_FP;
handle->handle.fp = fp;//赋值fd
handle->filename = filename ? zend_string_init(filename, strlen(filename), 0) : NULL;
}

然而yaf_config_ini_init 方法中 没有 fclose(handle->handle.fp)这个方法。

@fnu
Copy link

fnu commented Dec 24, 2023

#587

这里有修复

@laruence
Copy link
Owner

感谢@fnu, 应该被修复了,原因是从PHP8.1开始,ini_parser不再主动释放文件句柄了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants