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

Delayed OOM raised during compilation is dropped when compilation fails

Đang mở
#24,631 1 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 1 ngày

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

Từ ngày 25/10/2026.

  • #24694 của @srayuth089 — đang mở

Đánh giá

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

Hướng nghiên cứu

Start in Zend/zend.c around the zend_execute_script() logic linked in the issue, then compare how delayed OOM is handled in sapi/fuzzer/fuzzer-sapi.c. Reproduce with the provided php -n commands and check the result when compilation fails. Done means the memory limit error is reported instead of the parse error in that case, while the no-) case still reports the memory error.

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

Mô tả

Description

If the main script exceeds memory_limit while being compiled and compilation then fails, the memory error is never reported. The parse error is reported instead. zend_execute_script() only handles a pending delayed OOM when zend_compile_file() returns an op_array:

https://github.com/php/php-src/blob/31c0ea7d7ff1d1fccb6492e52dab544011628065/Zend/zend.c#L1988-L1993

@bhaak found the same problem in sapi/fuzzer/fuzzer-sapi.c: https://github.com/php/php-src/commit/31c0ea7d7ff1d1fccb6492e52dab544011628065#r206151500. Their fix also applies here: handle the delayed OOM outside the if (op_array) block.

The following code:

php -n -r 'file_put_contents("oom.php", "<?php\n\$a = \x27" . str_repeat("A", 3 << 19) . "\x27;\n)\n");'
php -n -d memory_limit=4M oom.php

Resulted in this output:

Parse error: Unmatched ')' in oom.php on line 3

But I expected this output instead:

Fatal error: Allowed memory size of 4194304 bytes exhausted (tried to allocate 2097152 bytes) in oom.php on line 2

Without the ) line, the memory error is reported.

PHP Version
PHP 8.5.12-dev (cli) (NTS), built from 31c0ea7d7ff1d1fccb6492e52dab544011628065
Operating System

Linux x86_64

Ngôn ngữ chính
C
Star
40.7k
Fork
8.3k
Merge trung bình
2 ngày 20 giờ
Pull request đã merge (30 ngày)
147

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

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 php/php-src

Tất cả issue của php/php-src

Issue tương tự

Thêm issue về C

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.