Similar to related issue, I've found with PHPCompatibility there we're still some places, where optional parameter was used before required.

FILE: ctools\ctools_plugin_example\plugins\relationships\relcontext_from_simplecontext.inc
------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
 27 | WARNING | Declaring a required parameter after an optional one is deprecated since PHP 8.0. Parameter $context is
    |         | optional, while parameter $conf is required.
------------------------------------------------------------------------------------------------------------------------

FILE: ctools\includes\entity-access.inc
------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------
 102 | WARNING | Declaring a required parameter after an optional one is deprecated since PHP 8.0. Parameter $entity is
     |         | optional, while parameter $entity_type is required.
 146 | WARNING | Declaring a required parameter after an optional one is deprecated since PHP 8.0. Parameter $entity is
     |         | optional, while parameter $entity_type is required.
------------------------------------------------------------------------------------------------------------------------

Issue fork ctools-3257747

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Mulambo created an issue. See original summary.

mulambo’s picture

mulambo’s picture

Status: Active » Needs review
andregp’s picture

Any special reason for not adding

  $entity = isset($entity) ? $entity : NULL;

into includes/entity-access.inc lines #103 and #148?

Just curious because I noticed you added

  $context = isset($context) ? $context : NULL;

on ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc after removing the NULL default value.

joelpittet made their first commit to this issue’s fork.

joelpittet’s picture

  • joelpittet committed 8861804 on 7.x-1.x authored by Mulambo
    Issue #3257747 by Mulambo, joelpittet, andregp: Required parameter after...
joelpittet’s picture

Status: Needs review » Fixed

Thank you both, I removed the $context = isset($context) ? $context : NULL; lines before commit because you'd have to explicitly pass in NULL so that is the value of $context already.

Status: Fixed » Closed (fixed)

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