Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 compatibility, fix "Warning - foreach() argument must be of type" #17688

Merged
merged 1 commit into from Jun 17, 2021

Conversation

Findus23
Copy link
Member

@Findus23 Findus23 commented Jun 17, 2021

refs #17686

fixes

WARNING [2021-06-17 22:11:46] 311625 /home/lukas/public_html/matomophp8/core/Db.php(829): Warning - foreach() argument must be of type array|object, string given - Matomo 4.4.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)

in php 8.1

I think

if (!is_array($parameters)) {
$parameters = array($parameters);

makes sure it worked correctly nevertheless, but the logging of the SQL query doesn't seem to contain such code.

Review

  • Functional review done
  • Potential edge cases thought about (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
  • Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • Security review done see checklist
  • Code review done
  • Tests were added if useful/possible
  • Reviewed for breaking changes
  • Developer changelog updated if needed
  • Documentation added if needed
  • Existing documentation updated if needed

@Findus23 Findus23 added Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. Needs Review PRs that need a code review labels Jun 17, 2021
@Findus23 Findus23 mentioned this pull request Jun 17, 2021
38 tasks
@diosmosis diosmosis merged commit b59ff15 into 4.x-dev Jun 17, 2021
@diosmosis diosmosis deleted the option-sql-array branch June 17, 2021 23:20
@mattab mattab changed the title pass array to Db::fetchOne() PHP 8.1 compatibility, fix "Warning - foreach() argument must be of type" Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants