array_map started to obey strict_types directive in PHP 8.6
@TimWolla 已經在處理了。
開始於 2026年9月24日。
評估
這個 Issue 還沒有評估資料。
描述
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)
- 主要語言
- C
- 星號
- 40.4k
- 分支
- 8.2k
- 平均合併
- 2 天 15 小時
- 30 天內合併 PR
- 113
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
php/php-src 的其他 Issue
-
Bug Status: Needs Triage
難度 2/5 1-3 小時 新手友好度 76/100
-
Bug Status: Needs Triage
難度 1/5 1 小時以內 新手友好度 90/100
-
Bug Status: Needs Triage
難度 2/5 1-3 小時 新手友好度 78/100
-
Bug Category: Tests Status: Verified
難度 2/5 1-3 小時 新手友好度 68/100
-
Bug SAPI: fpm Status: Needs Triage
難度 2/5 1-3 小時 新手友好度 65/100
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
-
難度 2/5 1-3 小時 新手友好度 72/100
-
難度 1/5 1 小時以內 新手友好度 90/100
-
難度 2/5 1-3 小時 新手友好度 82/100
NVIDIA/k8s-device-plugin#2061 · 1 則留言 ·
-
task
難度 2/5 1-3 小時 新手友好度 70/100
vsanthanam/JBird#429 ·