Bug #76190 [Opn->Dup]: \DateTime::__construct with microsecond failed with setlocale

From: Date: Sat, 07 Apr 2018 18:38:20 +0000
Subject: Bug #76190 [Opn->Dup]: \DateTime::__construct with microsecond failed with setlocale
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214639@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76190&edit=1 ID: 76190 Updated by: cmb@php.net Reported by: nicolas dot levee at gmail dot com Summary: \DateTime::__construct with microsecond failed with setlocale -Status: Open +Status: Duplicate Type: Bug Package: Date/time related Operating System: Any PHP Version: 7.0.27, 7.1.16 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Duplicate of bug #67127. Previous Comments: ------------------------------------------------------------------------ [2018-04-06 20:43:32] nicolas dot levee at gmail dot com I find something, if i change the locale to : ``` setlocale(LC_ALL, 'fr_FR.UTF-8'); ``` it's failed, if I let the default locale the function work properly ------------------------------------------------------------------------ [2018-04-06 10:31:46] nicolas dot levee at gmail dot com I have the same version on both. I'm using a Docker manualy configured on Debian 9 And I have the same problem with php 7.1.16. Here my package list : ii apache2 2.4.25-3+deb9u4 amd64 Apache HTTP Server ii apache2-bin 2.4.25-3+deb9u4 amd64 Apache HTTP Server (modules and other binary files) ii apache2-data 2.4.25-3+deb9u4 all Apache HTTP Server (common files) ii apache2-utils 2.4.25-3+deb9u4 amd64 Apache HTTP Server (utility programs for web servers) ii libapache2-mod-php7.0 7.0.27-0+deb9u1 amd64 server-side, HTML-embedded scripting language (Apache 2 module) ii php-apcu 5.1.8+4.0.11-1 amd64 APC User Cache for PHP ii php-apcu-bc 1.0.3-2 amd64 APCu Backwards Compatibility Module ii php-common 1:49 all Common files for PHP packages ii php-imagick 3.4.3~rc2-2 amd64 Provides a wrapper to the ImageMagick library ii php-pear 1:1.10.1+submodules+notgz-9 all PEAR Base System ii php-xml 1:7.0+49 all DOM, SimpleXML, WDDX, XML, and XSL module for PHP [default] ii php7.0 7.0.27-0+deb9u1 all server-side, HTML-embedded scripting language (metapackage) ii php7.0-bcmath 7.0.27-0+deb9u1 amd64 Bcmath module for PHP ii php7.0-cli 7.0.27-0+deb9u1 amd64 command-line interpreter for the PHP scripting language ii php7.0-common 7.0.27-0+deb9u1 amd64 documentation, examples and common module for PHP ii php7.0-curl 7.0.27-0+deb9u1 amd64 CURL module for PHP ii php7.0-dev 7.0.27-0+deb9u1 amd64 Files for PHP7.0 module development ii php7.0-fpm 7.0.27-0+deb9u1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary) ii php7.0-gd 7.0.27-0+deb9u1 amd64 GD module for PHP ii php7.0-intl 7.0.27-0+deb9u1 amd64 Internationalisation module for PHP ii php7.0-json 7.0.27-0+deb9u1 amd64 JSON module for PHP ii php7.0-mbstring 7.0.27-0+deb9u1 amd64 MBSTRING module for PHP ii php7.0-mcrypt 7.0.27-0+deb9u1 amd64 libmcrypt module for PHP ii php7.0-mysql 7.0.27-0+deb9u1 amd64 MySQL module for PHP ii php7.0-opcache 7.0.27-0+deb9u1 amd64 Zend OpCache module for PHP ii php7.0-readline 7.0.27-0+deb9u1 amd64 readline module for PHP ii php7.0-soap 7.0.27-0+deb9u1 amd64 SOAP module for PHP ii php7.0-xml 7.0.27-0+deb9u1 amd64 DOM, SimpleXML, WDDX, XML, and XSL module for PHP ii php7.0-zip 7.0.27-0+deb9u1 amd64 Zip module for PHP Hop this can help ------------------------------------------------------------------------ [2018-04-06 10:22:40] requinix@php.net The SAPI shouldn't matter. Are you sure you have the same version of PHP for both? ------------------------------------------------------------------------ [2018-04-06 09:31:39] nicolas dot levee at gmail dot com Description: ------------ My PHP Version 7.0.26 The \DateTime::__construct failed to format microsecond on Apache SAPI but succeed on CLI Test script: --------------- echo (new \DateTime("2018-04-06 09:42:14.999273"))->format("U.u"); Expected result: ---------------- 1523000534.999273 Actual result: -------------- 1523000534.000000 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76190&edit=1

« previous php.bugs (#214639) next »