|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74982 strftime %P not working on Alpine Linux
Submitted: 2017-07-24 18:18 UTC Modified: 2021-04-07 16:36 UTC
From: ryan at ryanparman dot com Assigned: cmb (profile)
Status: Closed Package: Date/time related
PHP Version: 7.1.7 OS: Alpine Linux 3.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
13 + 34 = ?
Subscribe to this entry?

 [2017-07-24 18:18 UTC] ryan at ryanparman dot com
I'm using the official PHP Docker container "php:7.1.7-fpm-alpine", which is based on Alpine Linux 3.4.

When using strftime() on Alpine Linux, the %P modifier does not appear to be supported. When used, the resulting value is (bool) false.

The documentation on says:

> Mac OS X only: The %P modifier is not supported in the Mac OS X implementation of this function.

I would assume that the follow-up to this ticket would either be:

1. To update the documentation to explain that this modifier is unsupported on Alpine Linux in addition to macOS. And/or…

2. That this is a proper bug, and Alpine Linux support should be fixed at some point.

Test script:

Expected result:
I expect the result to be `string(7) "06:12pm"`.

Actual result:
The actual result is `bool(false)`.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-24 19:10 UTC]
I believe this is the source for strftime on musl libc which is the C library used in Alphine linux:

It does not appear to support "%P", which would make this a documentation issue.
 [2018-02-28 22:11 UTC]
-Package: Unknown/Other Function +Package: Date/time related
 [2021-04-07 16:36 UTC]
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-04-07 16:36 UTC]
The documentation already mentions[1]:

| Not all conversion specifiers may be supported by your C
| library, in which case they will not be supported by PHP's
| strftime().

It shouldn't hurt to document that %P is not supported by musl,

Note that there is an RFC[2] to deprecate strftime().

[1] <>
[2] <>
 [2021-04-12 12:12 UTC]
Automatic comment on behalf of cmb69
Log: Fix #74982: strftime %P not working on Alpine Linux
 [2021-04-12 12:12 UTC]
-Status: Verified +Status: Closed
 [2021-04-14 18:12 UTC]
Automatic comment on behalf of mumumu
Log: Fix #74982: strftime %P not working on Alpine Linux
 [2021-04-21 14:31 UTC]
Automatic comment on behalf of Girgias
Log: Fix #74982: strftime %P not working on Alpine Linux
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 30 04:01:24 2021 UTC