-
Notifications
You must be signed in to change notification settings - Fork 1
Description
What happened?
I noticed that after implementing envkey-php in my project page loading got at lot slower only when running inside my Docker container (I'm on and M1 Mac).
I decided to take a look at what was causing the slow down with a profiler and I found out that a shell exec called by envkeys-php's fetch() function was responsible, located at:
Line 69 in fe151c6
| $res = rtrim(shell_exec($cmd)); |
The visualization of the profiler's results:

My analysis
I decided to try and debug it, and found out that this class ends up matching envkey-source binary for linux/amd64 when used inside the container, which runs a lot slower than the linux/arm64 binary on my machine of course.
I believe the cause of this behavior lies on the code (in the snipped bellow) that calls php_uname('m') to determine the cpu arch, but it can only match 'arm', while running uname -m inside the container yields 'aarch64'.
Line 22 in fe151c6
| } elseif (stristr(PHP_OS, 'DARWIN') && stripos(php_uname('m'), 'arm') !== false) { |
System Information
Hardware: MacBook Air
Chip: Apple M1 (aarch64)
Memory: 8 GB
OS: macOS 14.5 (Sonoma)
envkey-php version
2.4.4