Cleaning up types in php_stdiop_cast
还没有人认领这个 Issue。
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.1k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
The whole php_stdiop_cast is a proper mess. It defines php_socket_t fd but then it uses PHP_STDIOP_GET_FD which is defined as
#define PHP_STDIOP_GET_FD(anfd, data) anfd = (data)->file ? fileno((data)->file) : (data)->fd
which is actually always int. I assume that there are some users (external code) that casting and assume that php_socket_t is returned but I think this is incorrect and they should not assume that and it should be fixed there using proper casting. That would leave plain wrapper operating just on fd which is what I think it should.
Then why does it need to even SOCK_ERR here if it's not for socket in the first place? I think it should be redefined just to -1 or some new macro created (e.g. PHP_FD_ERR).
Originally posted by @bukka in https://github.com/php/php-src/pull/17506#discussion_r1921536084
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 php_stdiop_cast 和 PHP_STDIOP_GET_FD 的定义开始,然后追踪 SOCK_ERR 的调用者和使用位置;issue 未指明文件或测试。完成的标准是:wrapper 使用一致的文件描述符类型和错误哨兵值,不依赖于不受支持的外部 cast 假设,并检查受影响的兼容性预期。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, php
- 领域
- backend, operating-systems
- Issue 类型
- 重构
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 38/100