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

Setting LC_CTYPE to an empty string kills PHP on MacOS using Laravel Valet #21126

Open
michalkleiner opened this issue Aug 7, 2023 · 3 comments
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced.

Comments

@michalkleiner
Copy link
Contributor

Context

Not sure exactly what changed, whether update/upgrade related, but started receiving [pool valet] child 91253 exited on signal 6 (SIGABRT) after 0.485608 seconds from start error.

During debugging I found the call setlocale(LC_CTYPE, ''); in Locale.php is causing this. Different versions of PHP (8.0, 8.1, 8.2) same issue.

This prevents the whole Matomo app from starting correctly.

Expected Behavior

App starts and functions without issues.

Current Behavior

PHP crashes and doesn't load at all.

Steps to Reproduce (for Bugs)

Haven't managed to replicate it on other MacOS machine yet, but still worth creating the issue if someone comes across it. Then perhaps we can brainstorm how to fix this or document a workaround/an FAQ.

Your Environment

  • Matomo Version: 5.0.0-b4 but also latest 4.x-dev
  • PHP Version: 8.2.8
  • Server Operating System: MacOS Ventura 13.4.1 running Laravel Valet with php installed via brew
  • Additionally installed plugins:
  • Browser: Brave
  • Operating System: MacOS Ventura 13.4.1
@michalkleiner michalkleiner added Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member and removed To Triage An issue awaiting triage by a Matomo core team member labels Aug 7, 2023
@michalkleiner
Copy link
Contributor Author

Seems like passing the empty string is meant to use the system/environment-set value after LC_ALL is set, so restoring LC_CTYPE back to what it was. I've prepared a PR that does the same in a more explicit way and fixes the issue for me.

@michalkleiner michalkleiner added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Aug 7, 2023
@mcguffin
Copy link

mcguffin commented Mar 8, 2024

I did some digging.
This issue falls back to a configuration issue with homebrew php: Homebrew/homebrew-core#137431

Adding an LC_ALL env var to /opt/homebrew/etc/php/*/php-fpm.d/*.conf fixed it for me:

env['LC_ALL'] = C

@michalkleiner
Copy link
Contributor Author

Tried this and unless it's picking some other config files somewhere else this (sadly) didn't work for me. Added it to configs for all 3 versions I have installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced.
Projects
None yet
Development

No branches or pull requests

3 participants