Skip to content

Commit 858e6cd

Browse files
committed
fix: corrected fatal errors
1 parent f35bcdb commit 858e6cd

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

phpmyfaq/faq.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
}
172172

173173
// List all faq attachments
174+
$attachmentList = [];
174175
if ($faqConfig->get('records.disableAttachments') && 'yes' == $faq->faqRecord['active']) {
175176
try {
176177
$attList = AttachmentFactory::fetchByRecordId($faqConfig, $faqId);

phpmyfaq/src/phpMyFAQ/Category/Order.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,11 @@ public function setCategoryTree(
124124
public function getCategoryTree(array $categories, int $parentId = 0): array
125125
{
126126
$result = [];
127-
$stack = [[$parentId, &$result]];
128127

129-
while (!empty($stack)) {
130-
list($currentParentId, &$currentResult) = array_pop($stack);
131-
132-
foreach ($categories as $category) {
133-
if ((int) $category['parent_id'] === $currentParentId) {
134-
$currentResult[$category['category_id']] = [];
135-
$stack[] = [$category['category_id'], &$currentResult[$category['category_id']]];
136-
}
128+
foreach ($categories as $category) {
129+
if ((int)$category['parent_id'] === $parentId) {
130+
$childCategories = $this->getCategoryTree($categories, (int)$category['category_id']);
131+
$result[$category['category_id']] = $childCategories;
137132
}
138133
}
139134

0 commit comments

Comments
 (0)