PHP@8.4 outputting inecorrectly
Josh5A opened this issue · 2 comments
Josh5A commented
I installed your PHP 8.4 using homebrew. Since doing so I've noticed unusual output. I finally nailed down a reproducible case.
PHP versions
8.4, 8.3
Here is my test code:
<?php
$output = array(
array(1,0,0,0,0,1,2,12,11,9,5,2,1,0,0,0,0,0,0,0,0,0,0,0),
array(0,1,1,1,0,0,1,5,8,13,10,2,2,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,2,2,3,7,8,10,2,1,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,1,2,1,7,7,9,5,1,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,5,7,3,8,1,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,2,4,5,2,2,1,0,1,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,1,1,3,2,0,2,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,2,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,1,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0),
array(0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,1,2,1,1,3,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
array(0,0,0,2,1,3,4,3,9,5,2,1,0,0,0,0,0,0,0,0,0,0,0,0),
array(1,1,0,0,4,2,1,9,2,6,4,0,0,0,0,1,0,0,0,0,0,0,0,0)
);
function outputChart($output) {
echo "Sleep Hours VVV\t12am\t1am\t2am\t3am\t4am\t5am\t6am\t7am\t8am\t9am\t10am\t11am\t12pm\t1pm\t2pm\t3pm\t4pm\t5pm\t6pm\t7pm\t8pm\t9pm\t10pm\t11pm\n";
foreach ($output as $sleepHour => $wakeHours) {
if ($sleepHour == 0) {
echo "12am\t";
} else if ($sleepHour > 12) {
echo ($sleepHour - 12) . "pm\t";
} else {
echo $sleepHour . "am\t";
}
foreach ($wakeHours as $wakeHour) {
echo $wakeHour."\t";
}
echo "\n";
}
}
outputChart($output);
PHP 8.3 produces the correct output:
% /opt/homebrew/opt/php@8.3/bin/php -f testPhp.php
Sleep Hours VVV 12am 1am 2am 3am 4am 5am 6am 7am 8am 9am 10am 11am 12pm 1pm 2pm 3pm 4pm 5pm 6pm 7pm 8pm 9pm 10pm 11pm
12am 1 0 0 0 0 1 2 12 11 9 5 2 1 0 0 0 0 0 0 0 0 0 0 0
1am 0 1 1 1 0 0 1 5 8 13 10 2 2 0 0 0 0 0 0 0 0 0 0 0
2am 0 0 0 0 0 0 2 2 3 7 8 10 2 1 0 0 0 0 0 0 0 0 0 0
3am 0 0 0 0 0 0 1 2 1 7 7 9 5 1 0 0 0 0 0 0 0 0 0 0
4am 0 0 0 0 0 0 0 0 0 5 7 3 8 1 0 0 0 0 0 0 0 0 0 0
5am 0 0 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 2 1 1 0 0 0 0 0 0 0 0 0 0
10pm 0 0 0 2 1 3 4 3 9 5 2 1 0 0 0 0 0 0 0 0
11pm 1 1 0 0 4 2 1 9 2 6 4 0 0 0 0 1 0 0 0 0
Easier to see when pasted into spreadsheet:
8.3 output:
8.4 output:
shivammathur commented
I cannot reproduce the issue, it outputs correctly for me
Test: https://github.com/shivammathur/test-setup-php/actions/runs/10843393617/job/30090507182#step:4:1
Please try to reinstall php@8.4, so that you have the latest build and then test.
brew reinstall shivammathur/php/php@8.4
Josh5A commented
Still not working after that :( Any further info I could give you from my end to help diagnose the issue?