Fix PHP8 deprecated "optional parameter is provided before required" in search_api_execute_pending_tasks_batch function

Comments

meyerrob created an issue. See original summary.

drunken monkey’s picture

Component: General code » Framework
StatusFileSize
new629 bytes

Thanks for pointing out this problem. However, I fear your fix is not the correct one, as it wouldn’t allow passing NULL as the first parameter, which is the real reason that default value is there. (?SearchApiServer isn’t allowed in PHP 5.2.) Please see/test/review the attached patch with the, hopefully, correct fix.

meyerrob’s picture

You are totally right, the default value for the first parameter must default to null, therefore to make the second parameter optional as well seems to be a solution. Maybe we should be sure that the second parameter can´t be empty at all.

damienmckenna’s picture

Issue tags: +PHP 8.0
damienmckenna’s picture

Version: 7.x-1.28 » 7.x-1.x-dev

  • drunken monkey committed f15717e9 on 7.x-1.x
    Issue #3338975 by drunken monkey, meyerrob: Fixed deprecation warning in...
drunken monkey’s picture

Status: Needs review » Fixed

Maybe we should be sure that the second parameter can´t be empty at all.

It seems to have worked so far. Also, as it’s passed by reference, even passing NULL explicitly should be OK there. (But I don’t think that will ever happen.)
As you otherwise seem happy with the patch: committed.
Thanks again!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.