Daniel-KM / Omeka-S-module-CleanUrl

Displays clean and readable URLs like https://example.org/my_collection/dcterms:identifier in Omeka S.
Other
4 stars 4 forks source link

Deprecated Dynamic Property Access in CleanUrl Module on PHP 8.3.2 and Omeka S 4.0.4 #19

Open nakamura196 opened 3 months ago

nakamura196 commented 3 months ago

Environment

Issue Description

When running Omeka S with the Clean Url module version 3.17.7 on PHP 8.3.2, the following deprecation warning is logged:

User Deprecated: Creation of dynamic property CleanUrl\Router\Http\CleanRoute::$priority is deprecated in /var/www/html/vendor/laminas/laminas-router/src/SimpleRouteStack.php on line 285

This warning suggests that dynamic property creation is deprecated and potentially harmful for future PHP versions, impacting the module's compatibility and stability.

Steps to Reproduce

  1. Install Omeka S version 4.0.4 with PHP 8.3.2.
  2. Install and activate Clean Url module version 3.17.7.
  3. Access a feature or page that triggers routing processes in the Clean Url module.
  4. Check the PHP error log or Omeka S log for the deprecation warning.

Expected Behavior

The Clean Url module should not rely on deprecated features such as dynamic property creation, ensuring compatibility with current and future PHP versions without generating deprecation warnings.

Actual Behavior

A deprecation warning is logged due to the use of a dynamic property, indicating potential compatibility issues with future PHP versions.

Suggested Solution

A potential solution could be to explicitly declare the $priority property within the CleanRoute class or refactor the code to avoid relying on dynamic properties. This change would help ensure compatibility with PHP 8.3.2 and beyond, addressing the deprecation warning.

class CleanRoute implements RouteInterface {
    protected $priority; // Explicitly declare the property
    // The rest of the class implementation
}

Additional Context

This issue was identified during routine maintenance and testing of Omeka S with the latest PHP version. Addressing it would help maintain the stability and compatibility of the Clean Url module.