php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69289 fpm_status uses wrong time_format for json and xml output
Submitted: 2015-03-24 15:02 UTC Modified: 2019-06-26 09:42 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: rainer dot jung at kippdata dot de Assigned:
Status: Open Package: FPM related
PHP Version: 5.6.7 OS: Solaris 10 (and older)
Private report: No CVE-ID: None
 [2015-03-24 15:02 UTC] rainer dot jung at kippdata dot de
Description:
------------
The fpm status page contains an item "start time". It is shown in the text view as (example):

start time:           24/Mar/2015:14:18:15 +0100

In the json and xml views (short and full) it is shown as:

<start-time>%s</start-time>

resp.

{...,"start time":%s,...}

Instead of the correct time a verbatim "%s" is shown.

This is due to fpm_status.c setting

time_format = "%s";

in the xml and json case, but to

time_format = "%d/%b/%Y:%H:%M:%S %z";

in the text and html case. This format is then used in strftime(), e.g.

strftime(time_buffer, sizeof(time_buffer) - 1, time_format, localtime(&proc.start_epoch));

Unfortunately "%s" is not a correct strftime format pattern, so strftime does not format the time but instead returns the verbatim "%s" pattern.

Please replace 

time_format = "%s";

by

time_format = "%d/%b/%Y:%H:%M:%S %z";

or something else that formats correctly and returns valid xml and json data.

The bug applies to the current master branch and also to 5.6, 5.5 and 5.4.

Thanks a bunch!


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-26 09:42 UTC] rainer dot jung at kippdata dot de
-Operating System: Any +Operating System: Solaris 10 (and older)
 [2019-06-26 09:42 UTC] rainer dot jung at kippdata dot de
The strftime %s problem is Solaris 10 (and older) specific. Linux and Solaris 11 know about %s in strftime.
 [2023-03-02 08:23 UTC] croverwnorene8 at googlemail dot com
Thanks for post..  https://www.mygeorgiasouthern.org/github.com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 18:01:28 2024 UTC