php / php/php-src

Preloading has no defined io-stream constants

未关闭
#10,673 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Extension: opcache SAPI: cli Status: Needs Triage
主要语言
C
星标
40.4k
派生
8.2k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

Description

As of https://www.php.net/manual/en/features.commandline.io-streams.php , there should be constants defined in CLI.

Added the following to preload.ini:

opcache.preload_user=www-data
opcache.preload=/path/to/preload.php

The following code wrote to preload.php:

<?php

var_dump(defined('STDIN'));
var_dump(defined('STDOUT'));
var_dump(defined('STDERR'));

Resulted in this output:

/path/to/preload.php:3:
bool(false)
/path/to/preload.php:4:
bool(false)
/path/to/preload.php:5:
bool(false)

But I expected this output instead:

/path/to/preload.php:3:
bool(true)
/path/to/preload.php:4:
bool(true)
/path/to/preload.php:5:
bool(true)

I could imagine this is the expected behavior but docs should be updated then. :) There are no restrictions defined in https://www.php.net/manual/en/opcache.preloading.php BTW, the opcache_enabled shown as false for var_dump(opcache_get_status(false));.

PHP Version

8.1.16

Operating System

Docker image: php:8.1-fpm-bullseye

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用 preload.ini 和 preload.php 在 PHP 8.1.16 的镜像 php:8.1-fpm-bullseye 中复现该报告,然后将结果与 issue 中链接的 CLI I/O 流和 opcache preloading 文档进行比较。确定在预加载期间是否应定义 STDIN、STDOUT 和 STDERR;当行为按预期工作,或文档明确说明该限制时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
cli
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。