array_map started to obey strict_types directive in PHP 8.6
@TimWolla đang làm issue này rồi.
Từ ngày 24/9/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Description
The following code:
<?php declare(strict_types=1);
array_map(trim(...), [1]);
Resulted in this output (on PHP 8.6):
PHP Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, int given in /home/jnoordsij/foo.php:3
Stack trace:
#0 /home/jnoordsij/foo.php(3): trim()
#1 {main}
thrown in /home/jnoordsij/foo.php on line 3
But I expected this output instead (as it is on PHP 8.5):
(Arguably the first outcome may as well be considered correct/preferable, as there is a type error here; then one could consider this a PHP 8.5 and older bug, but fixing that is probably more impactful)
PHP Version
PHP 8.6.0beta3 (cli) (built: Sep 23 2026 10:57:45) (NTS)
Copyright © The PHP Group and Contributors
Built by Ubuntu
Zend Engine v4.6.0-dev, Copyright © Zend by Perforce
with Xdebug v3.6.0alpha1, Copyright (c) 2002-2026, by Derick Rethans
with Zend OPcache v8.6.0beta3, Copyright ©, by Zend by Perforce
Compared to
PHP 8.5.10 (cli) (built: Aug 28 2026 07:23:25) (NTS)
Copyright (c) The PHP Group
Built by Ubuntu
Zend Engine v4.5.10, Copyright (c) Zend Technologies
with Xdebug v3.5.3, Copyright (c) 2002-2026, by Derick Rethans
with Zend OPcache v8.5.10, Copyright (c), by Zend Technologies
Operating System
Ubuntu 26.04 (wsl)
Additional notes
Spotted in context of https://github.com/paratestphp/paratest/pull/1130 in https://github.com/paratestphp/paratest/actions/runs/32967771822/job/107268607956?pr=1130#step:5:37 (and subsequently https://github.com/paratestphp/paratest/pull/1138)
- Ngôn ngữ chính
- C
- Star
- 40.4k
- Fork
- 8.2k
- Merge trung bình
- 2 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 113
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của php/php-src
-
Bug Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Bug Status: Needs Triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Bug Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Flaky hrtime.phpt test Đang mởBug Category: Tests Status: Verified
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Bug SAPI: fpm Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
zephyrproject-rtos/zephyr#120318 · 1 bình luận ·
-
issue: bug report
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
darktable-org/darktable#22386 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100