Open lifeofguenter opened 2 months ago
Thank you for the report. Does the error go away if you disable the JIT?
switching from
opcache.jit = "function"
to
opcache.jit = "tracing"
solved the issue for us on multiple laravel-based applications
Thank you. Note that, even with tracing JIT, the problem may still reappear when the relevant code actually gets jitted.
I can't reproduce the problem with the provided code.
Could you please isolate the problem. It should be enough to capture the argument passed to ``Composer\Semver\VersionParser->manipulateVersionString()" from "Composer\Semver\VersionParser->parseConstraint()" at https://github.com/composer/semver/blob/3.4.0/src/VersionParser.php#L276.
Then the test case should look like:
<?php
function manipulateVersionString(array $matches, $position, $increment = 0, $pad = '0') {
for ($i = 4; $i > 0; --$i) {
if ($i > $position) {
$matches[$i] = $pad;
} elseif ($i === $position && $increment) {
$matches[$i] += $increment;
// If $matches[$i] was 0, carry the decrement
if ($matches[$i] < 0) {
$matches[$i] = $pad;
--$position;
// Return null on a carry overflow
if ($i === 1) {
return null;
}
}
}
}
}
manipulateVersionString($CAPTURED_ARGUMENT);
?>
However, there is something wrong in your code. https://github.com/composer/semver/blob/3.4.0/src/VersionParser.php#L276 doesn't pass the required second argument.
@dstogov
- its not my code :P - and the pupose of showing the code was not to make it reproducible but to show that the code is simply impossible to throw an error. Is it really just argument that could throw jit off? Then I can attempt to have a look again.
In case you see this problem and jit=off - the JIT has a bug. I see that exception shouldn't be thrown at that point, but I can't guess about the consequences that leaded to it. In case I had a reproduction, I most probably fixed this in a day.
opcache.jit="function"
must be deterministic and should lead to the problem on each function call with the sane arguments.
- There are two functions constraint vs constraints. The code is calling a different function.
You are right. I was wrong.
I need arguments passed from https://github.com/composer/semver/blob/3.4.0/src/VersionParser.php#L410 that lead to the wrong exception.
Description
The following code:
Full source: https://github.com/composer/semver/blob/3.4.0/src/VersionParser.php#L541
Resulted in this output:
But I expected this output instead:
Full stack trace:
It is impossible for this error to happen, but also it happens only intermittently with no re-deployment/code-changes.
I suspect something with opcache, current config:
It seems to happen more often when vapor-core package is installed - despite not running on vapor.
PHP Version
PHP 8.2.21 + 8.3.9
Operating System
Debian Bookworm