|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-05-06 17:29 UTC] drop_box at live dot de
Description:
------------
Since Windows 10 1803 php crash the apache service (httpd.exe),
when setlocal is called in the "wrong" order and then strftime is called with %Z format on all other formats like %z the "crash" doesn't happen.
Wrong order:
setlocale(LC_TIME,'en_US.UTF-8');
setlocale(LC_CTYPE,'en_US.UTF-8');
strftime('%Z');
Right order:
setlocale(LC_CTYPE,'en_US.UTF-8');
setlocale(LC_TIME,'en_US.UTF-8');
strftime('%Z');
Error is notice in alle php 7+ version (5.6 doesn't had this issue)
tested version: 5.6.35 (no issue here) ,7.0.29, 7.1.16, 7.2.4, 7.2.5
Test script:
---------------
<?php
$value = strftime('%Z');
echo $value.'%Z';
echo '<br>';
setlocale(LC_TIME,'en_US.UTF-8');
$value = strftime('%Z');
echo $value.'%Z';
echo '<br>';
setlocale(LC_CTYPE,'en_US.UTF-8');
// here came the crash in the next line
$value = strftime('%Z');
echo $value.'%Z';
echo '<br>';
Expected result:
----------------
Result should be that it behavior in the same as when you run %z.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 15:00:01 2025 UTC |
@drop_box, I still have no crash even on the debug build :/ Perhaps it depends on the system locale, dunno. Which locale is on your machine by default? And nevertheless, since you can compile yourself, could you please apply the following and see whether it fixes the issue? diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 993a7b11cf..1a8f3a8e83 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1644,7 +1644,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) zend_long timestamp = 0; struct tm ta; int max_reallocs = 5; - size_t buf_len = 256, real_len; + size_t buf_len = 512, real_len; timelib_time *ts; timelib_tzinfo *tzi; timelib_time_offset *offset = NULL; Thanks.