Closed Alkarex closed 4 months ago
Also reproduces in CLI webserver. I'll take a look... I think this is related to frameless function calls. EDIT: only reproduces with opcache on EDIT2: gets broken by the DFA optimizer pass somehow
The problem is that this line in the VM: ZVAL_NULL(result);
changes the type of arg1
as well, because after the DFA pass the result and input both use CV0($result).
I attempted a fix in https://github.com/php/php-src/pull/14876, but got stuck on the JIT which fails on arm64 with "stack smashing detected". And I don't feel like digging into it more. The VM part of my patch works fine, it's just the JIT stuff that needs more work. Someone else can pick up where I left off with my PR.
Note: for some reason, the max()
function does not seem affected
It seems like working around this in the optimizer is as simple as changing opline_supports_assign_contraction
on first sight. Let me try...
Description
Hello, The
min()
function seems to fail (returnsnull
) on a typed integer, but only in specific situations and environments.Notes:
php84-apache2
(i.e. from a Web browser) but not when called from CLI (command line).int
parameter (function testMin(int $value)
) but not on untyped parameter (function testMin($value)
).The following code:
Resulted in this output:
But I expected this output instead:
System information:
PHP Version
PHP 8.4.0alpha1
Operating System
Alpine Linux 3.21.0_alpha20240606 (edge)