-
Notifications
You must be signed in to change notification settings - Fork 7.9k
match expression matches first expression within a function/method using apache2handler sapi #11134
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
Comments
What if you disable opcache? |
This is a bug in OPcache.
|
I forgot to mention above if you comment out the second expression it works as expected. Also if you don't use the ?? operator it also works correctly. function testFunction1()
{
$subj = $unset_variable ?? null;
$result = match ($subj) {
'Some-Text' => 'Incorect-Match-1',
'Other-Text' => 'Incorect-Match-2',
default => 'Expected-Result',
};
var_dump($result); // string 'Incorect-Match-1' (length=16)
}
testFunction1();
function testFunction2()
{
$subj = null;
$result = match ($subj) {
'Some-Text' => 'Incorect-Match-1',
'Other-Text' => 'Incorect-Match-2',
default => 'Expected-Result',
};
var_dump($result); // string 'Expected-Result' (length=15)
}
testFunction2();
function testFunction3()
{
$subj = $unset_variable ?? null;
$result = match ($subj) {
'Some-Text' => 'Incorect-Match-1',
//'Other-Text' => 'Incorect-Match-2',
default => 'Expected-Result',
};
var_dump($result); // string 'Expected-Result' (length=15)
}
testFunction3(); Hopefully that will help pin it down. |
iluuu1994
added a commit
to iluuu1994/php-src
that referenced
this issue
Apr 26, 2023
Oof. Thanks for the report. The fix is here: #11135 |
iluuu1994
added a commit
to iluuu1994/php-src
that referenced
this issue
Apr 26, 2023
Dang fast response and patch... great work! - thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Description
This issue is visible on Apache/2.4.52, the cli works as expected however something with the sapi (apache2handler) gives you bad results. If you run the following code you will get the correct results on the first page load however if you refresh the page you will get the document incorrect matches below.
The following code:
<test.php>
The text was updated successfully, but these errors were encountered: