-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
bug64539-status-json-encoding.phpt fail on 32-bits #17208
Comments
Hmm, this part is really strange:
For some reason it's not getting query string. It will need some debugging. I just created #17239 which will allow printing a bit more info for this with setting |
Here's debug build and logs
|
Was able to reproduce this in an i386/alpine container. |
The reason this breaks is because of a type mismatch. php-src/sapi/fpm/fpm/fpm_status.c Line 611 in b09ed9a
However, it is passed to a format string which expects 4 bytes ( @andypost Please try the following patch: diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c
index cc3412149c7..96bdb96e408 100644
--- a/sapi/fpm/fpm/fpm_status.c
+++ b/sapi/fpm/fpm/fpm_status.c
@@ -608,7 +608,7 @@ int fpm_status_handle_request(void) /* {{{ */
time_buffer,
(unsigned long) (now_epoch - proc->start_epoch),
proc->requests,
- duration.tv_sec * 1000000UL + duration.tv_usec,
+ (unsigned long) (duration.tv_sec * 1000000UL + duration.tv_usec),
proc->request_method[0] != '\0' ? proc->request_method : "-",
proc->request_uri[0] != '\0' ? proc->request_uri : "-",
query_string ? "?" : "",
|
@nielsdos checked your patch and the test pass, thank you! |
The reason this breaks is because of a type mismatch. The following line uses fields of the timeval struct which are both 8 bytes on Alpine 32-bit, which results in a computed value of also 8 bytes: https://github.com/php/php-src/blob/b09ed9a0f25cda8c9eea9d140c01587cd50b4aa8/sapi/fpm/fpm/fpm_status.c#L611 However, it is passed to a format string which expects 4 bytes (`unsigned long` and thus the `%lu` format specifier is 4 bytes on Alpine 32-bit), resulting in argument corruption. Since the value is generally small, truncating to 4 bytes is sufficient to fix this.
@andypost Thanks for checking, PR made! |
* PHP-8.3: Fix GH-17208: bug64539-status-json-encoding.phpt fail on 32-bits
* PHP-8.4: Fix GH-17208: bug64539-status-json-encoding.phpt fail on 32-bits
Description
The following test fails on 32-bit arches building 8.4.2 for Alpinelinux https://gitlab.alpinelinux.org/alpine/aports/-/pipelines/283003
PHP Version
PHP 8.4.2
Operating System
Alpinelinux
The text was updated successfully, but these errors were encountered: