-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP 8.4 min function fails on typed integer #14873
Comments
Sole fix needed so far seems to be related to https://wiki.php.net/rfc/deprecate-implicitly-nullable-types See also upstream PR PhpGt/CssXPath#227 We are also hitting was seems to be a PHP bug php/php-src#14873
Also reproduces in CLI webserver. I'll take a look... I think this is related to frameless function calls. |
The problem is that this line in the VM: |
The DFA pass may cause the op1 and result argument to be equal to each other. In the VM we always use ZVAL_NULL(result) first, which will also destroy the first argument. Use a temporary result to fix the issue.
The DFA pass may cause the op1 and result argument to be equal to each other. In the VM we always use ZVAL_NULL(result) first, which will also destroy the first argument. Use a temporary result to fix the issue.
The DFA pass may cause the op1 and result argument to be equal to each other. In the VM we always use ZVAL_NULL(result) first, which will also destroy the first argument. Use a temporary result to fix the issue.
The DFA pass may cause the op1 and result argument to be equal to each other. In the VM we always use ZVAL_NULL(result) first, which will also destroy the first argument. Use a temporary result to fix the issue.
The DFA pass may cause the op1 and result argument to be equal to each other. In the VM we always use ZVAL_NULL(result) first, which will also destroy the first argument. Use a temporary result to fix the issue.
I attempted a fix in #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 |
* Initial support for PHP 8.4 Sole fix needed so far seems to be related to https://wiki.php.net/rfc/deprecate-implicitly-nullable-types See also upstream PR PhpGt/CssXPath#227 We are also hitting was seems to be a PHP bug php/php-src#14873 * Fix return type * Disable OPCache while waiting for PHP fix
It seems like working around this in the optimizer is as simple as changing |
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). We should not contract assignments with CVs in frameless calls with arguments. An older attempt is found at phpGH-14876 that tried to modify the VM/JIT.
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). We should not contract assignments with CVs in frameless calls with arguments. An older attempt is found at phpGH-14876 that tried to modify the VM/JIT.
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)
The text was updated successfully, but these errors were encountered: