Skip to content

Fix fatal error issue in in_array function#445

Merged
swissspidy merged 5 commits intowp-cli:mainfrom
itsmekopila:fix/429
May 6, 2025
Merged

Fix fatal error issue in in_array function#445
swissspidy merged 5 commits intowp-cli:mainfrom
itsmekopila:fix/429

Conversation

@itsmekopila
Copy link
Copy Markdown
Contributor

Fix: #429

A fatal error occurred in the in_array function when the site options auto_update_plugins and auto_update_themes were set to string values. I fixed this by adding a condition to check if they are not arrays.

@itsmekopila itsmekopila requested a review from a team as a code owner March 18, 2025 08:41
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@mrsdizzie mrsdizzie added the bug label Mar 19, 2025
@mrsdizzie mrsdizzie added this to the 2.1.24 milestone Mar 19, 2025
@swissspidy
Copy link
Copy Markdown
Member

Would you be up for adding a test for this as well?

Please also update the branch by merging the latest changes from the main branch

@swissspidy
Copy link
Copy Markdown
Member

Hmm now there are some changes from main in this diff 🤔 I was thinking more of a simple git merge main or git rebase main. But anyhow, some tests would be good. Let us know if you need help with that.

@swissspidy
Copy link
Copy Markdown
Member

@itsmekopila friendly ping 👋 would you be able to address the diff issues and add some tests?

@itsmekopila
Copy link
Copy Markdown
Contributor Author

@itsmekopila friendly ping 👋 would you be able to address the diff issues and add some tests?

I'm setting up WP-CLI tests locally to run tests and will fix diff issues.

@itsmekopila
Copy link
Copy Markdown
Contributor Author

itsmekopila commented Apr 1, 2025

Hi @swissspidy,

Could you please guide me on how to set up the database and connect it properly to run Behat? I followed the WP CLI tests guide but ran into some issues. It seems like I wasn't able to connect the database correctly. When I run the composer run prepare-tests command, I get the error shown in the attached file. Also, when I run composer run behat, it just gets stuck and doesn’t load anything. I try with database type splite also.

Could you please guide me through the setup and testing process from the start?

Thanks in advance!

image
image
image

@swissspidy
Copy link
Copy Markdown
Member

Since you're using MariaDB, I'd suggest running composer update again.

We just merged some MariaDB-related improvements on Friday to make running tests more robust. Then composer run prepare-tests should work better.

Using SQLite is a nice workaround though, then you don't need to run prepare-tests. But strange that it fails for you 🤔

@schlessera
Copy link
Copy Markdown
Member

@itsmekopila Looking at the error you've posted, I can see that the script detected MySQL v10.4, which seems to be a bug in the script. I'll check to find out what is going on. I'm assuming you're using MariaDB v10.4.

@swissspidy
Copy link
Copy Markdown
Member

@schlessera FYI we improved the db type detection quite a bit recently, see wp-cli/wp-cli-tests#246

@schlessera
Copy link
Copy Markdown
Member

This is what I think is the problem here: wp-cli/wp-cli-tests#251

You have the mysql client binary installed and that makes the script think it is using MySQL, as it erroneously checks the client instead of the server.

@swissspidy swissspidy merged commit d21a2f5 into wp-cli:main May 6, 2025
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4 participants