php / php/php-src

Fwrite to stdout in childprocess not shown

オープン
#11,383 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Category: Program Execution SAPI: cli Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

it won't write text there so you don't know there is a prompt. (fwrite(STDOUT, $text) also i get a timeout (execute timeout) in my own framework which holds some more code. and if i write something to stdin it wont get accepted / continue executing script.

test1.php

<?php 
$command = escapeshellcmd(PHP_BINARY) . ' ' . escapeshellarg(__DIR__ . '/test2.php');
var_dump(exec($command, $output)); 
var_dump($output);

test2.php

<?php
function my_readline($text='') { 
fwrite(STDOUT, $text); 
return trim(fgets(STDIN)); 
} 
$a = my_readline('test: ');
echo $a;

the fwrite to STDOUT isn't executed if i run test1.php

PHP Version

8.2

Working in php 7.4

Operating System

Debian 11.6

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Debian 11.6 上の PHP 8.2 で issue の test1.php および test2.php スクリプトを使って動作を再現し、子プロセスの stdout プロンプトと stdin の処理を PHP 7.4 と比較します。次に、exec と子プロセスの I/O の動作を追跡して、fwrite(STDOUT, $text) が表示されない理由、または入力が継続しない理由を特定します。プロンプトが表示され、タイムアウトせずに入力を受け付ければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
cli
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。