Bug #74982 [Ver->Csd]: strftime %P not working on Alpine Linux
Edit report at https://bugs.php.net/bug.php?id=74982&edit=1
ID: 74982
Updated by: git@php.net
Reported by: ryan at ryanparman dot com
Summary: strftime %P not working on Alpine Linux
-Status: Verified
+Status: Closed
Type: Bug
Package: Date/time related
Operating System: Alpine Linux 3.4
PHP Version: 7.1.7
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmb69
Revision: https://github.com/php/doc-en/commit/6936064e733f39045f471aad492abdeed7c4d2c6
Log: Fix #74982: strftime %P not working on Alpine Linux
Previous Comments:
------------------------------------------------------------------------
[2021-04-07 16:36:24] cmb@php.net
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,
though.
Note that there is an RFC[2] to deprecate strftime().
[1] <https://www.php.net/strftime>
[2] <https://wiki.php.net/rfc/deprecations_php_8_1>
------------------------------------------------------------------------
[2017-07-24 19:10:55] danack@php.net
I believe this is the source for strftime on musl libc which is the C library used in Alphine linux:
http://git.musl-libc.org/cgit/musl/tree/src/time/strftime.c?id=ac0acd569e01735fc6052d43fdf57f3a07c93f3d
It does not appear to support "%P", which would make this a documentation issue.
------------------------------------------------------------------------
[2017-07-24 18:18:16] ryan at ryanparman dot com
Description:
------------
I'm using the official PHP Docker container "php:7.1.7-fpm-alpine", which is based on
Alpine Linux 3.4.
https://github.com/docker-library/php/blob/ddc7084c8a78ea12f0cfdceff7d03c5a530b787e/7.1/fpm/alpine/Dockerfile
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 http://php.net/strftime 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:
---------------
https://gist.github.com/skyzyx/55e2dea4e7f8fbc6854b2c81f51e8cf9
Expected result:
----------------
I expect the result to be string(7) "06:12pm".
Actual result:
--------------
The actual result is bool(false).
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74982&edit=1
Thread (4 messages)