Skip to content

Conversation

@mambax7
Copy link
Collaborator

@mambax7 mambax7 commented Oct 9, 2025

No description provided.

@mambax7 mambax7 requested a review from Copilot October 9, 2025 09:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a PHP error "Cannot use bool as array" by updating array destructuring patterns in while loops. The issue occurs when fetchRow() returns false (indicating no more rows) but the code attempts to destructure it as an array.

  • Replaced direct array destructuring assignments in while loop conditions with proper null checks
  • Added intermediate variable assignments to safely handle fetchRow() return values
  • Maintained existing logic flow while preventing the type error

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
htdocs/xoops_lib/modules/protector/admin/center.php Fixed array destructuring in database result loops and corrected control flow logic
htdocs/pda.php Updated while loop to safely handle fetchRow return value
htdocs/modules/system/include/update.php Fixed array destructuring in template ID collection loop
htdocs/modules/system/class/maintenance.php Added proper null check for fetchRow in database dump method
htdocs/modules/profile/class/visibility.php Updated field ID collection loop to handle fetchRow safely
htdocs/kernel/session.php Fixed session data retrieval with proper null checking
htdocs/class/xoopstree.php Updated multiple tree traversal methods to handle fetchRow safely
htdocs/class/model/stats.php Fixed array destructuring in statistics counting methods
htdocs/class/model/joint.php Updated link count retrieval to handle fetchRow safely
htdocs/banners.php Fixed multiple banner statistics loops to handle fetchRow safely

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@mambax7 mambax7 requested a review from Copilot October 9, 2025 12:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +120 to +123
if ($db->isResultSet($result)) {
$row = $db->fetchRow($result);
if (false !== $row) {
[$ip] = $row;
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is inverted. The condition should check !$db->isResultSet($result) as in the original code. isResultSet() returns true for valid result sets, but you want to process the data when you have a valid result set, not when you don't.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant