Skip to content

Conversation

@baullmear
Copy link

Description

Fixes PHP 8.1+ deprecation warnings when writing CSV rows with null values.

Problem

  • rowToStr() accepts null values (line 348: is_null($column) check)
  • But then passes null to str_replace() which doesn't accept null in PHP 8.1+
  • Results in: Deprecated: Passing null to parameter #3 ($subject) of type array|string

Solution

  • Add null coalescing operator: $column ?? ''
  • Null values become empty strings (maintains existing behavior)
  • Fully backward compatible
  • Eliminates deprecation warning

Testing

✅ Tested with real-world production data containing null values

  • No deprecation warnings
  • CSV output unchanged
  • 530+ rows processed successfully

zajca and others added 6 commits February 1, 2023 15:27
- Add null coalescing operator to handle null column values
- Prevents 'Passing null to parameter' deprecation warning in PHP 8.1+
- Maintains backward compatibility with existing behavior (null becomes empty string)
- Fixes issue where writeRow() accepts null values but str_replace() doesn't
@baullmear
Copy link
Author

Please careful, vibecoded PR :)

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