PHP Deprecated message only on server PHP Deprecated: Optional parameter $importLastOccurrenceOnly declared before required parameter $param is implicitly treated as a required parameter.
This error not getting on local but on server.
The error tells you exactly what the issue is
You need to declare optional parameters after required paramaters.
Here is an example:
function index($param, $importLastOccurrenceOnly = 'value')
@gych but it working on local n suddenly it started throwing error
@SandavHeena Change it on local to, it can give you unexpected results when those params are not in the right order. That's why this is deprecated.
Which PHP version do you use locally and on the server?
@SandavHeena Is this exactly the same version both on local and on server ? This is deprecated since PHP version 8.0
@gych no on local its PHP 8.1.13 and on server PHP 8.2.17
@gych protected function importDataRows(
TimestampRange $importTimestamps,
array $toExclude = null,
array $uniqueConstraint = null,
$importLastOccurrenceOnly = false,
$param
): array {
@SandavHeena Strange that you're not getting the error on local but anyways its good to change it to this:
protected function importDataRows(TimestampRange $importTimestamps, $param, array $toExclude = null, array $uniqueConstraint = null, $importLastOccurrenceOnly = false): array {
Also change this at places in your code where you call this method so the parameters are added in the right order.
Please sign in or create an account to participate in this conversation.