Topic: Function strpos() is deprecated in PHP 8.1
I am still on version 4.5.2M of LuxCal and after upgrading to PHP 8.1, I am getting the following message for every calendar entry being displayed:
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/seidenphp/htdocs/luxcal/common/retrieve.php on line 187
Here is the code beginning at the function ProcessEvent:
function processEvent($from, $till, $eStart, $eEnd, &$row) {
global $evtList, $usr, $set;
$sTs = mktime(12,0,0,substr($from,5,2),substr($from,8,2),substr($from,0,4));
$eTs = mktime(14,0,0,substr($till,5,2),substr($till,8,2),substr($till,0,4));
for($i=$sTs;$i<=$eTs;$i+=86400) { //increment 1 day
$evt = array();
$curD = date('Y-m-d', $i);
if (strpos($row['xda'], $curD) === false) { //no exceptions
The above line is line 187 within the retrieve.php. I've reviewed 5.2.0M code as shown below:
if (strpos($row['xda'], $curD) !== false) { continue; } //exception: skip
which is a bit different but still gets the produces the same deprecated warning on the page.
Please advise on a code fix for this.
Thanks,
Mark