Project

General

Profile

Actions

Regression #15892

closed

PHP error: usr/local/www/acme/acme_accountkeys.php:158

Added by Steve Wheeler 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
ACME
Target version:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
Affected Version:
2.8.0
Affected Plus Version:
24.11
Affected Architecture:
All

Description

When trying to select account keys in the ACME package in 24.11:

16:16:02 PHP ERROR: Type: 1, File: /usr/local/www/acme/acme_accountkeys.php, Line: 158, Message: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/acme/acme_accountkeys.php:158
Stack trace:
#0 {main}
thrown
Actions #1

Updated by Jim Pingle 5 months ago

  • Assignee set to Jim Pingle
Actions #2

Updated by Jim Pingle 5 months ago

  • Status changed from New to Feedback

Looks like the only way that could happen is if their config has some invalid/wrong item tag in the account keys section. Either it's empty, it's not an array, or otherwise not in the expected format. I can't replicate that even if I try adding various bogus tags into the config, though.

It would help to see the config.xml section for <acme>...<accountkeys>[...]</accountkeys>...</acme> looks like from an installation which produces this error. Don't need the secret info it can be masked, but the structure of the section and any empty elements must remain intact.

Actions #3

Updated by Jim Pingle 5 months ago

  • Status changed from Feedback to In Progress

As soon as I hit submit there I had another idea and replicated it with a bad item tag that looks like this:

<item>1</item>

We can make the page ignore those bad tags, but they should really be removed from the configuration.

Actions #4

Updated by Jim Pingle 5 months ago

Simple patch to apply the fix until the new package is ready:

diff --git a/x/usr/local/www/acme/acme_accountkeys.php b/x/usr/local/www/acme/acme_accountkeys.php
index dfc918409416..8975ef839bb0 100644
--- a/x/usr/local/www/acme/acme_accountkeys.php
+++ b/x/usr/local/www/acme/acme_accountkeys.php
@@ -155,6 +155,9 @@ display_top_tabs_active($acme_tab_array['acme'], "accountkeys");
                                <tbody class="user-entries">
 <?php
                foreach (config_get_path('installedpackages/acme/accountkeys/item', []) as $accountkey) {
+                       if (empty($accountkey) || !is_array($accountkey)) {
+                               continue;
+                       }
                        $accountname = htmlspecialchars($accountkey['name']);
                        ?>
                        <tr id="fr<?=$accountname;?>" <?=$display?> onClick="fr_toggle('<?=$accountname;?>')" ondblclick="document.location='acme_accountkeys_edit.php?id=<?=$accountname;?>';">

Actions #5

Updated by Jim Pingle 5 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

Fixed in ACME pkg v0.9

Actions #6

Updated by Jim Pingle 5 months ago

  • Target version deleted (2.8.0)
  • Plus Target Version deleted (25.01)
Actions

Also available in: Atom PDF