[php-src] PR #25199: Fix implode($array, null) throwing on the frameless call path

From: Date: Thu, 05 Nov 2026 03:10:34 +0000
Subject: [php-src] PR #25199: Fix implode($array, null) throwing on the frameless call path
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40309@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25199 Author: b84330808 This change and the description below were written by an LLM (Claude Code). > PHP_FUNCTION(implode) accepts an array as the first argument > when the second is null, which is the same as implode($array), and > the stub allows it (string|array $separator, ?array $array = null). > The frameless variant that direct two-argument calls compile to parses argument 1 as a string > unconditionally, so whether the call works depends on how it's made: > > ```php > $a = ['a', 'b']; > implode($a, null); // TypeError: implode(): Argument #1 ($separator) must be > of type string, array given > call_user_func('implode', $a, null); // "ab" > join($a, null); // "ab" (the alias isn't frameless) > ``` > > implode($a, 'x') also blames argument 1, while the > regular function reports Argument #2 ($array) must be of type ?array, string > given. > > The fix handles an array first argument the way the regular function does. > > The new phpt fails without the fix. It passes with it, also under opcache with function and > tracing JIT, along with ext/standard/tests/strings and > Zend/tests/frameless*. > > This is a regression in 8.4, where frameless calls were introduced. 8.3 only has the regular > function, which accepts this call. Targeting PHP-8.4. The diff also applies to master.

« previous php.git-pulls (#40309) next »