php / php/php-src

File descriptors / some procfs entries not openable by php

Đang mở
#9,551 10 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Category: Streams Feature
Ngôn ngữ chính
C
Star
40.4k
Fork
8.2k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
96

Mô tả

Description

The following code:

<?php
file_put_contents("/proc/1/fd/1", "hi");

Resulted in this output:

file_put_contents(/proc/1/fd/1): failed to open stream: No such file or directory

But I expected this output instead:

2

This is highly impactful for containerized PHP environments. php-fpm has unique workarounds that they've utilized, and in the past the fd stream wrapper was implemented to support managing the current process's file descriptors, but if you are in a different SAPI and/or utilize forking or execing to other PHP scripts, stdout in a docker container quickly turns into a black hole in terms of container logging, where it's expected that all logs are sent to the PID 1 stdout/err. See: https://bugs.php.net/bug.php?id=53465 where they hypothesize this is due to PHP incorrectly attempts to dereference the pseudo-symlink before opening it. The hypothesis makes sense to me. It'd be nice to see this fixed for all file descriptors.

PHP Version

7.4

Operating System

Centos 7.9

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Không có tệp nguồn hoặc bài kiểm thử nào được nêu. Hãy bắt đầu bằng cách tái hiện ví dụ PHP với /proc/1/fd/1 và đọc bug được liên kết về việc giải tham chiếu pseudo-symlink, sau đó lần theo đường dẫn mở tệp cho các descriptor procfs. Hoàn thành khi các descriptor như /proc/1/fd/1 có thể được mở và tạo ra kết quả mong đợi trên tất cả SAPIs.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
c, php
Lĩnh vực
operating-systems
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.