- Notifications
You must be signed in to change notification settings - Fork8k
Closed
Description
Description
This issue is visible onApache/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>
<?php// TEST-1: Functioning as expected - PASS$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)// TEST-2: Incorrectly matches first expression - FAILSfunctiontestFunction1(){$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();// TEST-3: Incorrectly matches first expression - FAILSclass TestClass1{publicfunction__construct() {$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) }}$test_class =newTestClass1();// TEST-4: Functioning as expected - PASSfunctiontestFunction2(){$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)}testFunction2();// TEST-5: Functioning as expected - PASSclass TestClass2{publicfunction__construct() {$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) }}$test_class =newTestClass2();### PHP VersionPHP8.1.2### Operating SystemUbuntu22.04.1