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

From: Date: Tue, 24 Mar 2015 15:02:31 +0000
Subject: Bug #69289 [NEW]: fpm_status uses wrong time_format for json and xml output
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191570@lists.php.net to get a copy of this message
From:             rainer dot jung at kippdata dot de
Operating system: Any
PHP version:      5.6.7
Package:          FPM related
Bug Type:         Bug
Bug description:fpm_status uses wrong time_format for json and xml output

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 bug report at https://bugs.php.net/bug.php?id=69289&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=69289&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=69289&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=69289&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=69289&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=69289&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=69289&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=69289&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=69289&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=69289&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=69289&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=69289&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=69289&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=69289&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69289&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=69289&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=69289&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=69289&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69289&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=69289&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=69289&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#191570) next »