Skip to content

Add type validation for $sheet_letters to prevent TypeError in PHP 8+ - #15

Merged
protitude merged 3 commits into
md-1172from
copilot/sub-pr-14
Feb 11, 2026
Merged

Add type validation for $sheet_letters to prevent TypeError in PHP 8+#15
protitude merged 3 commits into
md-1172from
copilot/sub-pr-14

Conversation

Copilot AI commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

The GoogleSheetsProcess constructor calls strtolower() on $sheet_letters without validating it's a string, causing TypeError when NULL/array is passed from misconfigured plugin settings.

Changes:

  • Added is_string() check before string operations on $sheet_letters
  • Defaults to empty string for invalid types (NULL, array, etc.)
  • Empty string results in no columns being selected for processing
public function __construct($gsheet_returned_data, $sheet_letters, $process = 'ss') {
  // ... existing validation ...
  
  // Validate sheet_letters is a string before processing.
  // If not a string (e.g., NULL, array), default to empty string
  // which results in no columns being selected for processing.
  if (!is_string($sheet_letters)) {
    $sheet_letters = '';
  }

  // Sanitize sheet letters input.
  $sheet_letters = strtolower($sheet_letters);
  // ...
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 11, 2026 19:17
Co-authored-by: protitude <695625+protitude@users.noreply.github.com>
Co-authored-by: protitude <695625+protitude@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP Address feedback on PR Md 1172 for improvements and changes Add type validation for $sheet_letters to prevent TypeError in PHP 8+ Feb 11, 2026
Copilot AI requested a review from protitude February 11, 2026 19:18
@protitude
protitude marked this pull request as ready for review February 11, 2026 19:25
@protitude
protitude merged commit 15af437 into md-1172 Feb 11, 2026
@protitude
protitude deleted the copilot/sub-pr-14 branch February 11, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants