Bug #69289 [Opn]: fpm_status uses wrong time_format for json and xml output

From: Date: Wed, 26 Jun 2019 09:42:10 +0000
Subject: Bug #69289 [Opn]: fpm_status uses wrong time_format for json and xml output
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221500@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69289&edit=1

 ID:                 69289
 User updated by:    rainer dot jung at kippdata dot de
 Reported by:        rainer dot jung at kippdata dot de
 Summary:            fpm_status uses wrong time_format for json and xml
                     output
 Status:             Open
 Type:               Bug
 Package:            FPM related
-Operating System:   Any
+Operating System:   Solaris 10 (and older)
 PHP Version:        5.6.7
 Block user comment: N
 Private report:     N

 New Comment:

The strftime %s problem is Solaris 10 (and older) specific. Linux and Solaris 11 know about %s in
strftime.


Previous Comments:
------------------------------------------------------------------------
[2015-03-24 15:02:30] 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!



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=69289&edit=1


Thread (3 messages)

« previous php.bugs (#221500) next »