Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Side effects run out of order in echo lists and array literal keys

Đã đóng
#143 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@Giandonn đang làm issue này rồi.

Từ ngày 2/10/2026.

  • #144 của @Giandonn — đang mở

Đánh giá

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

Hướng nghiên cứu

Reproduce the PHP and TypePHP outputs from the issue, then trace the pre-statement temporary materialization for nested calls in echo operands and array key/value evaluation. Add regression coverage for the three examples and verify that side effects, output, and exceptions occur in PHP's order without changing the already-correct constructs.

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

Mô tả

A call nested inside an expression can be materialized into a pre-statement temporary. In two constructs this moves side effects (output, mutations, exceptions) ahead of work PHP performs first.

<?php
function f(string $s): string { echo "[$s]"; return $s; }
function boom(): string { throw new RuntimeException('boom'); }

function main(): void
{
    echo "A", var_export(f("1"), true), "\n";
    try { echo "E-", var_export(boom(), true), "\n"; } catch (RuntimeException $e) { echo "| caught\n"; }
    $a = [f("k1") => strtoupper(f("v1")), f("k2") => f("v2")];
    echo "\n";
}
PHP TypePHP master
echo "A", var_export(f("1"), true) A[1]'1' [1]A'1'
echo "E-", var_export(boom(), true) E- then the exception the exception, E- is never printed
[f("k1") => strtoupper(f("v1")), f("k2") => f("v2")] [k1][v1][k2][v2] [v1][k1][v2][k2]

echo prints each operand before evaluating the next, and PHP evaluates an array key before its value. Function arguments, concatenation, binary operators and plain array values keep the right order (checked the same way).

Found with a differential fuzzer. Environment: PHP 8.4.26 ZTS + embed, GCC 11, Linux x64, master.

Ngôn ngữ chính
PHP
Star
1.4k
Fork
80
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
25

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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.

Issue khác của swoole/typephp

Tất cả issue của swoole/typephp

Issue tương tự

Thêm issue về PHP

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.