-
Notifications
You must be signed in to change notification settings - Fork 313
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
BUG: Wrong separator used in get_synonyms on Windows #3984
Comments
@nymwo is your database also hosted on Windows? The synonyms content comes from the |
It has been 3 days since more information was requested from you in this issue and we have not heard back. This issue is now marked as stale and will be closed in 3 days, but if you have more information to add then please comment and the issue will stay open. |
Yes, the database is on Windows. This is what is sent when i press "Save changes" on the synonym admin page:
Though minified, I can see that |
It has been 3 days since more information was requested from you in this issue and we have not heard back. This issue is now marked as stale and will be closed in 3 days, but if you have more information to add then please comment and the issue will stay open. |
@nymwo do you want to craft a PR with that change? Thanks! |
I'm not sure where it makes sense to make the change. If not passing PHP_EOL to the JS script, maybe there should be a line break fix here: ElasticPress/includes/classes/REST/Synonyms.php Lines 94 to 118 in b432690
or here: ElasticPress/includes/classes/Feature/Search/Synonyms.php Lines 859 to 874 in b432690
|
Describe the bug
The Synonym feature doesn't work when hosted on Windows.
In wp-content\plugins\elasticpress\includes\classes\Feature\Search\Synonyms.php we can se that the synonyms are separated (explode) by PHP_EOL, which is \r\n on Windows:
But it looks like $this->get_synonyms_raw() always returns a string with synonyms separated by \n. On Linux, PHP_EOL is defined as \n, so this issue does not appear when running on that OS.
Changing PHP_EOL to "\n" resolves the issue on Windows.
Steps to Reproduce
Screenshots, screen recording, code snippet
No response
Environment information
No response
WordPress and ElasticPress information
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: