Skip to content

AdminerRowNumbers plugin PHP Fatal error: Constant expression contains invalid operations #1167

@niol

Description

@niol

Adminer version: master
Compiled: single file
Plugins used: AdminerRowNumbers

Using PHP 8.2

From the official Php documentation :

Like any other PHP static variable, static properties may only be initialized using a literal or constant before PHP 5.6; expressions are not allowed. In PHP 5.6 and later, the same rules apply as const expressions: some limited expressions are possible, provided they can be evaluated at compile time.

Obvious fix is as follows, but not sure this is the right fix regarding performance.

--- i/plugins/row-numbers.php
+++ w/plugins/row-numbers.php
@@ -13,7 +13,7 @@ class AdminerRowNumbers extends Adminer\Plugin {
        }

        function backwardKeysPrint($backwardKeys, $row) {
-               static $n = $_GET["page"] * Adminer\adminer()->selectLimitProcess();
+               $n = $_GET["page"] * Adminer\adminer()->selectLimitProcess();
                $n++;
                echo "$n.\n";
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions