Problem/Motivation

Dates are being mangled by the PHP-intl module

Proposed resolution

Not sure -- symfony needs the php-intl module, but there's definitely problems here

Remaining tasks

Patch needed

User interface changes

None

API changes

None that I know of

http://drupal.org/node/1944636

Steps to reproduce:

* Check out a fresh Drupal 8 install via git
* Make sure the PHP "intl" module is installed on the web server (and that the web server was restarted)
* Create a new "Basic Page" node
* Click on the "Edit" tab
* Click on the "Authoring Information" accordian tab
* Notice that the date is set as "131313-MayMay-2121" and that the time is similarly garbled.
* Disable the php-intl module
* Restart the web server
* Notice that when you edit the node, the authoring information is normal

Note that this issue looks very similar to http://drupal.org/node/1944636, which was supposed to solve this a similar issue, but apparently doesn't fix this particular case.

Also note that I've tested this across several different browsers, and even gone so far as to fire up a packet sniffer to show that bad data really is coming from the web server.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Priority: Normal » Major
Issue tags: +intl

Closed #1992562: invalid "authored on" date as a duplicate of this, raising priority.

Micha1111’s picture

Same error here:

php 5.4.9 cgi-mode

intl server configuration attached

Ist not possible to save an edited article/page

Cameron Tod’s picture

Cannot reproduce error with the following config:

MAMP PHP 5.3.14
INTL version PECL-2.0.1
ICU version 51.1
ICU Data version 51.1

Head at 3cdae05

Berdir’s picture

Can you try to run the DateTime tests, especially DateTimePlusIntl on your system and check if that's green?

Cameron Tod’s picture

██ cameron.tod @ macbookair-camerontod:~/Sites/drupal  (8.x) 
██ 20:25:30 $ php -i | grep intl
intl
intl.default_locale => no value => no value
intl.error_level => 0 => 0

██ cameron.tod @ macbookair-camerontod:~/Sites/drupal  (8.x) 
██ 20:25:33 $ php core/scripts/run-tests.sh --url http://local.drupal.org Datetime

Drupal test run
---------------

Tests to be run:
 - Datetime Field (Drupal\datetime\Tests\DatetimeFieldTest)
 - DateTimePlusIntl (Drupal\system\Tests\Datetime\DateTimePlusIntlTest)
 - DateTimePlus (Drupal\system\Tests\Datetime\DateTimePlusTest)
 - DrupalDateTime (Drupal\system\Tests\Datetime\DrupalDateTimeTest)

Test run started:
 Saturday, May 25, 2013 - 21:25

Test summary
------------

Datetime Field 131 passes, 0 fails, and 0 exceptions
DateTimePlusIntl 14 passes, 0 fails, and 0 exceptions
DateTimePlus 54 passes, 0 fails, and 0 exceptions
DrupalDateTime 14 passes, 0 fails, and 0 exceptions
jaredsmith’s picture

@cam8001 -- do you have the intl module installed that comes with PHP, or just the PECL module? This problem seems to happen with the intl module built into PHP (at least with 5.3 and later). On Red Hat / Fedora / CentOS systems, it is provided as part of the "php-intl" package.

jaredsmith’s picture

Testing under Fedora, with PHP version 5.4.15 and MySQL version 5.5.31, from a fresh installation via git, 8.x branch at commit 08e824610c7c09e8bd0c023b756ee9712f649e12.

I have the following PHP packages installed:

php-channel-guzzle-1.3-2.fc18.noarch
php-cli-5.4.15-1.fc18.x86_64
php-phpunit-PHPUnit-3.7.20-1.fc18.noarch
php-soap-5.4.15-1.fc18.x86_64
php-symfony2-Yaml-2.2.1-1.fc18.noarch
php-symfony2-EventDispatcher-2.2.1-1.fc18.noarch
php-xml-5.4.15-1.fc18.x86_64
php-common-5.4.15-1.fc18.x86_64
php-gd-5.4.15-1.fc18.x86_64
php-PsrLog-1.0.0-2.fc18.noarch
php-twig-Twig-1.13.0-1.fc18.noarch
php-recode-5.4.15-1.fc18.x86_64
php-channel-phpunit-1.3-6.fc18.noarch
php-phpunit-File-Iterator-1.3.3-1.fc18.noarch
php-phpunit-PHP-TokenStream-1.1.5-1.fc18.noarch
php-pdo-5.4.15-1.fc18.x86_64
php-symfony2-BrowserKit-2.2.1-1.fc18.noarch
php-symfony2-Routing-2.2.1-1.fc18.noarch
php-EasyRdf-0.7.2-3.fc18.noarch
php-symfony2-Serializer-2.2.1-1.fc18.noarch
php-channel-ezc-1-5.fc18.noarch
php-mysql-5.4.15-1.fc18.x86_64
php-mbstring-5.4.15-1.fc18.x86_64
php-tidy-5.4.15-1.fc18.x86_64
php-phpunit-PHP-Invoker-1.1.2-1.fc18.noarch
php-symfony2-Finder-2.2.1-1.fc18.noarch
php-symfony2-DomCrawler-2.2.1-1.fc18.noarch
php-doctrine-DoctrineCommon-2.3.0-2.fc18.noarch
php-bcmath-5.4.15-1.fc18.x86_64
php-phpunit-Text-Template-1.1.4-1.fc18.noarch
php-symfony2-Process-2.2.1-1.fc18.noarch
php-symfony2-ClassLoader-2.2.1-1.fc18.noarch
php-5.4.15-1.fc18.x86_64
php-ezc-ConsoleTools-1.6.1-5.fc18.noarch
php-process-5.4.15-1.fc18.x86_64
php-symfony2-Config-2.2.1-1.fc18.noarch
php-channel-symfony2-1.3-1.fc18.noarch
php-redland-1.0.14.1-3.fc18.x86_64
php-pgsql-5.4.15-1.fc18.x86_64
php-symfony2-Console-2.2.1-1.fc18.noarch
php-phpunit-PHP-CodeCoverage-1.2.10-1.fc18.noarch
php-channel-doctrine-1.3-4.fc18.1.noarch
php-devel-5.4.15-1.fc18.x86_64
php-phpunit-PHPUnit-MockObject-1.2.3-1.fc18.noarch
php-pear-1.9.4-11.fc18.2.noarch
php-phpunit-PHP-Timer-1.0.4-1.fc18.noarch
php-ezc-Base-1.8-5.fc18.noarch
php-symfony2-DependencyInjection-2.2.1-1.fc18.noarch
php-symfony2-CssSelector-2.2.1-1.fc18.noarch
php-pecl-xdebug-2.2.2-1.fc18.x86_64
php-channel-twig-1.3-1.fc18.noarch

and will be testing with and without:

php-intl-5.4.15-1.fc18.x86_64

Output of php -m is:

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
json
libxml
mbstring
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
recode
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
uploadprogress
wddx
xdebug
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]
Xdebug

(obviously, this list also includes intl when I have that package installed.)

First of all, the test *without* php-intl installed

[jsmith@hockey drupal]$ php core/scripts/run-tests.sh --url http://drupal8.local Datetime

Drupal test run
---------------

Tests to be run:
 - Datetime Field (Drupal\datetime\Tests\DatetimeFieldTest)
 - DateTimePlusIntl (Drupal\system\Tests\Datetime\DateTimePlusIntlTest)
 - DateTimePlus (Drupal\system\Tests\Datetime\DateTimePlusTest)
 - DrupalDateTime (Drupal\system\Tests\Datetime\DrupalDateTimeTest)

Test run started:
 Tuesday, May 28, 2013 - 09:12

Test summary
------------

FATAL Drupal\datetime\Tests\DatetimeFieldTest: test runner returned a non-zero error code (255).
- Found database prefix 'simpletest214786' for test ID 1.
[28-May-2013 09:12:18 America/New_York] PHP Fatal error:  Call to a member function bundle() on a non-object in /var/www/html/drupal/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php on line 421
[28-May-2013 09:12:18 America/New_York] PHP Stack trace:
[28-May-2013 09:12:18 America/New_York] PHP   1. {main}() /var/www/html/drupal/core/scripts/run-tests.sh:0
[28-May-2013 09:12:18 America/New_York] PHP   2. simpletest_script_run_one_test() /var/www/html/drupal/core/scripts/run-tests.sh:22
[28-May-2013 09:12:18 America/New_York] PHP   3. Drupal\simpletest\TestBase->run() /var/www/html/drupal/core/scripts/run-tests.sh:482
[28-May-2013 09:12:18 America/New_York] PHP   4. Drupal\datetime\Tests\DatetimeFieldTest->testDateField() /var/www/html/drupal/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php:742
[28-May-2013 09:12:18 America/New_York] PHP   5. Drupal\datetime\Tests\DatetimeFieldTest->renderTestEntity() /var/www/html/drupal/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php:125

- Removed test files directory.
- Removed 35 leftover tables.
DateTimePlusIntl 0 passes, 0 fails, and 0 exceptions

FATAL Drupal\system\Tests\Datetime\DateTimePlusIntlTest: Found no database prefix for test ID 2. (Check whether setUp() is invoked correctly.)DateTimePlus 54 passes, 0 fails, and 0 exceptions
DrupalDateTime 8 passes, 4 fails, and 8 exceptions

Test run duration: 27 sec

Now with the php-intl package installed:

[jsmith@hockey drupal]$ php core/scripts/run-tests.sh --url http://drupal8.local Datetime

Drupal test run
---------------

Tests to be run:
 - Datetime Field (Drupal\datetime\Tests\DatetimeFieldTest)
 - DateTimePlusIntl (Drupal\system\Tests\Datetime\DateTimePlusIntlTest)
 - DateTimePlus (Drupal\system\Tests\Datetime\DateTimePlusTest)
 - DrupalDateTime (Drupal\system\Tests\Datetime\DrupalDateTimeTest)

Test run started:
 Tuesday, May 28, 2013 - 09:18

Test summary
------------

FATAL Drupal\datetime\Tests\DatetimeFieldTest: test runner returned a non-zero error code (255).
- Found database prefix 'simpletest622247' for test ID 5.
[28-May-2013 09:18:36 America/New_York] PHP Fatal error:  Call to a member function bundle() on a non-object in /var/www/html/drupal/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php on line 421
[28-May-2013 09:18:36 America/New_York] PHP Stack trace:
[28-May-2013 09:18:36 America/New_York] PHP   1. {main}() /var/www/html/drupal/core/scripts/run-tests.sh:0
[28-May-2013 09:18:36 America/New_York] PHP   2. simpletest_script_run_one_test() /var/www/html/drupal/core/scripts/run-tests.sh:22
[28-May-2013 09:18:36 America/New_York] PHP   3. Drupal\simpletest\TestBase->run() /var/www/html/drupal/core/scripts/run-tests.sh:482
[28-May-2013 09:18:36 America/New_York] PHP   4. Drupal\datetime\Tests\DatetimeFieldTest->testDateField() /var/www/html/drupal/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php:742
[28-May-2013 09:18:36 America/New_York] PHP   5. Drupal\datetime\Tests\DatetimeFieldTest->renderTestEntity() /var/www/html/drupal/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php:125

- Removed test files directory.
- Removed 35 leftover tables.
DateTimePlusIntl 14 passes, 0 fails, and 0 exceptions
DateTimePlus 54 passes, 0 fails, and 0 exceptions
DrupalDateTime 8 passes, 4 fails, and 8 exceptions

Test run duration: 28 sec
Cameron Tod’s picture

@jaredsmith - I was testing with the PECL module.

marcingy’s picture

I can't recreate this on php 5.4.7 (xampp) and intl

version  1.1.0  
ICU version  4.6.1  
ICU Data version  4.6 
Micha1111’s picture

No solution ?

Can not test D8 without saving nodes !

rodsouto’s picture

i have just installed drupal 8 and i get this error every time i try to create/edit a node, i'll try to dig in it tomorrow to see what's happening :)

catch’s picture

Priority: Major » Critical

Bumping to critical.

jaredsmith’s picture

I'm still seeing this on a fresh Drupal 8 installation via git as well.

jaredsmith’s picture

Just for curiosity, I also tried this on PHP 5.5 (along with the 5.5 version of it's php-intl module):

[jsmith@hockey drupal]$ php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
recode
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
uploadprogress
wddx
xdebug
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]
Xdebug

I try to run the tests, but they're now failing:

[jsmith@hockey drupal]$ php core/scripts/run-tests.sh --url http://drupal8.local Datetime
PHP Fatal error:  Call to undefined function simpletest_classloader_register() in /var/www/html/drupal/core/scripts/run-tests.sh on line 32
PHP Stack trace:
PHP   1. {main}() /var/www/html/drupal/core/scripts/run-tests.sh:0

Unfortunately, I still get the same results as I did with PHP 5.4.

ybabel’s picture

+1 after fres install from GIT, unable to create nodes

g_miric’s picture

+1 - unable to edit nodes
(I have this problem in Firefox, but not in Chrome)

Pancho’s picture

See also comments on #2006484-31: Remove dependency on datetime from node and following.

Damien Tournoud’s picture

Status: Active » Needs review
FileSize
1.21 KB

Looking at the code, it seems we are missing a lot of those, everywhere. It's not completely obvious how to fix the field widget implementations, but this should at least go in the direction of fixing the form element.

webchick’s picture

Closed #2057295: php-intl support breaks node add page as another dupe of this. It has some nice steps to reproduce.

dlu’s picture

Component: base system » datetime.module

Moved to datetime.module per #2050763-16: Refine "base system" component (notes on refactoring of "base system" category here: https://docs.google.com/a/acquia.com/spreadsheet/ccc?key=0AusehVccVSq2dF...).

Micha1111’s picture

FileSize
99.22 KB
131.16 KB
31.09 KB

Same error again

PHP Version 5.4.16 nmm1 (CGI)

INTL 1.1.0
ICU 4.8.1.1
ICU Data 4.8.1

derheap’s picture

I spend some time inserting debug()-calls in the core.

I'm not able to tell why, but what is happing is more or less the following:

* When PHP-Itnl is present the correct(?) date and time from system.date_format.html_time.yml are loaded: Intl: 'H:mm:ss';
* But the PHP-Intl formatter is sometimes(?) not executed;
* Somtimes as some dates are correct …
* Instead the parent formatter is called and this is the normal PHP-DateTime formatter;
* This formatter produces from H:mm:ss the plain wrong time18:0909:0606 and date.

Maybe this helps.

I am just right now not able to write a test against it. It was my first peek into Drupal 8 core today. To much to learn for one day.

yuradoc’s picture

Like I described here https://drupal.org/node/2087505 I have pb with creating nodes.
I have built-in intl module in PHP. I did try both PECL and module:
version 1.1.0
ICU version 4.8.1.1
ICU Data version 4.8.1
I use Drupal 8-dev from GIT - 12.09.2013.
I use "XAMPP for Linux 1.8.3-0". You could try it to reproduce pb.

yuradoc’s picture

1. datetime.module function datetime_datetime_form_process has callings of the DrupalDateTime format function without second parameter where we must pass in array with key format_string_type (simeth like described in patch #18). Another functions has such pbs too. It must be changed here, I think, or DrupalDateTime and DateTimePlus format functions must be changed.

2. DrupalDateTime format function:
this line $format = preg_replace(array('/\\\\\\\\/', '/(?<!\\\\)([AaeDlMTF])/'), array("\xEF\\\\\\\\\xFF", "\xEF\\\\\$1\$1\xFF"), $format);
cause sometimes pb with creating new IntlDateFormatter at DateTimePlus format function.

3. datetime.module function datetime_datetime_validate not worked
$date = $input['object']; is null when validate executed I think $date = $element['#default_value'] must be used instead (not sure). After changes it starts work.

derheap’s picture

Assigned: Unassigned » derheap
Status: Needs review » Needs work

All calls in DateTime.Module to date->format() are missing the second parameter for the format type.
So the formating defaults to PHP, which leeds to the error.

I will try to work out a patch, and first look again on the patch from #18.

yuradoc’s picture

Hello. Please try my patch, I'm not sure it's OK fully, but resolves a pb for me.

yuradoc’s picture

Assigned: derheap » yuradoc
Status: Needs work » Needs review

Status: Needs review » Needs work
yuradoc’s picture

I think that patch fails because of the using DrupalDateTime format function without passing format_string_type in tests definations.
Check it for a while without automatic testing. Tests may need to be modify.

yuradoc’s picture

Assigned: yuradoc » Unassigned

I unassign myself because of my busy. Very interesting if somebody tested patch from #26.

derheap’s picture

The patch seems to work for me. But the tests are failing also localy.

Two things about the patch:

1/ You added an extra parameter to datetime_format_example(). That changes the the API. datetime_format_example() could/should call datetime_default_format_type() like datetime_html5_format() it does. That would make the patch smaller, we dont have to change that many function calls.

2/ Why the changes to lib/Drupal/Core/Datetime/DrupalDateTime.php? I don’t think they are related to the error.

I can’t fix the patch right now. Simpeltest is failing for me even with a fresh Drupal 8 repo right now.

yuradoc’s picture

Status: Needs work » Needs review
FileSize
5.75 KB

Hello. I make changes like described at #31.1. It placed in new patch.
The 2. DrupalDateTime I changed for two reasons:
1. $settings must be passed to the parent::format. It's related to this pb, because format_string_type needs to be passed too.
2. see #24.2. I comment it while this pb wouldn't be resolved.

One note: after some testing I found that some values pass validation that are wrong. It seems to me that date_parse and other functions that parse date, time from string has a bug. In validation I use DateTime::modify and it seems that it works the same like date_parse. Example 2013-0u-15.

Status: Needs review » Needs work
yuradoc’s picture

Sorry, found some bug. Reuploaded.

yuradoc’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
derheap’s picture

I spend some time on this patch.

1/ The changes to /core/lib/Drupal/Core/Datetime/DrupalDateTime.php are breaking some of the tests.
And for me the don't fix the bug.

2/ Most changes to datetime.module are working. Date and Time are displayed correct.

3/ This chunk is working, but is breaking the tests.

@@ -574,9 +575,10 @@ function datetime_datetime_validate($element, &$form_state) {
     }
     else {
       // If the date is valid, set it.
-      $date = $input['object'];
-      if ($date instanceOf DrupalDateTime && !$date->hasErrors()) {
-        form_set_value($element, $date, $form_state);
+      $date = $element['#default_value'];
+      $new_date = @$date->modify($input['date'].' '.$input['time']);
+      if ($new_date && $new_date instanceOf DrupalDateTime && !$new_date->hasErrors()) {
+        form_set_value($element, $new_date, $form_state);
       }
       // If the date is invalid, set an error. A reminder of the required
       // format in the message provides a good UX.

4/ Today I have found the reason:
The function form_type_datetime_value() reads the values from the form and creates an date object, if the formats are ok.
Thefore it calls DrupalDateTime::createFromFormat() which the calls the PHP Core DateTime::createFromFormat().
And this functions works only with normal PHP format strings. So the date is not valid, when it is called with an INTL format string.

So: Either we create a working createFromFormat function, that works with INTL format strings or scrape the whole INTL stuff alltogether and use only PHP formats.

yuradoc’s picture

Status: Needs review » Needs work
FileSize
8.2 KB

Hello. I made an experimental patch that contains modification of the createFromFormat.
I know that this function called by a lot of other places, so every changes must be done very careful. Please help to check it if it's work in most ways, maybe it requires some improvements.

yuradoc’s picture

Status: Needs work » Needs review

yuradoc’s picture

Status: Needs work » Needs review
FileSize
8.57 KB

Updated patch. Trying to remove some warnings.

Status: Needs review » Needs work
yuradoc’s picture

Hello. I post patch again, sorry. Only now found how to use testing in WEB-interface of the D8 instalation.
Must be OK with passing.

yuradoc’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: -intl
yuradoc’s picture

Status: Needs work » Needs review
Issue tags: +intl
yuradoc’s picture

Cool! Automatically testings finished successfully.
Now guys, please help us to review this patch - may you have some notices or ideas for improving of the DateTimePlus::createFromFormat.
Big thanks to derheap for #37 and other comments. Also thanks to Damien Tournoud for patch #18 that helped me too.

yuradoc’s picture

Hello. I removed some whitespaces, because git apply thrown them.

Status: Needs review » Needs work
Issue tags: -intl
yuradoc’s picture

Status: Needs work » Needs review
Issue tags: +intl
derheap’s picture

I tested the patch with PHP-Intl enabled.
I can now create a node and change the date.
There are no more mangled date-examples.

I tested again without PHP-Intl enabled.
Also no errors.

So for me the bug is fixed.

@everbody
I am new to the issue queque. What I am supposed to do now?

yuradoc’s picture

Thanks for reporting derheap.
Does anybody has some results too?
I have the same question - what to do next with patch?

yuradoc’s picture

I talked on IRC contribute chat. They said that users that made review of patch could set status to "reviewed & tested by the community".

jthorson’s picture

yuradoc:

The next step, now that the 'manual testing' step is complete, is for someone to do a detailed patch review (which will look at the approach to solving the problem, coding standards, etc.).

Once that is complete, and if no issues found, the reviewer will update the issue to 'Reviewed and tested by community' status; otherwise they will update it to 'needs work' and identify any further changes which need to be taken.

See https://drupal.org/patch/review for more information on the patch review process.

yuradoc’s picture

Hello.
I upload the patch that contains "Coding Standards" improvements founded after chattings with chx on #drupal-contribute IRC.

Cyberwolf’s picture

Closed #2074535: Warning: date_format() expects parameter 1 to be DateTime, boolean given in Drupal\node\NodeFormController->form() (line 202 of as a duplicate of this one.

Edit: undid this, does not seem to be the exact same issue.

yuradoc’s picture

Hello. I upload patch with Unit Test included.

Status: Needs review » Needs work
yuradoc’s picture

Hello - as previous patch is not possible to apply - please use #55.
I upload Unit Test separately (i made an archieve because it's not possible to upload php file). Please place file in "/core/modules/system/lib/Drupal/system/Tests/Datetime" folder. Don't forget clean test environment. After that test can be founded in Datetime group.

yuradoc’s picture

Status: Needs work » Needs review
FileSize
10.58 KB

Updated patch with Unit Test.

chx’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, this looks really great!

alexpott’s picture

+++ b/core/lib/Drupal/Component/Datetime/DateTimePlus.php
@@ -205,20 +205,57 @@ public static function createFromFormat($format, $time, $timezone = NULL, $setti
-      // The createFromFormat function is forgiving, it might create a date that

+++ b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php
@@ -124,7 +124,7 @@ public function format($format, $settings = array()) {
     $settings['calendar'] = !empty($settings['calendar']) ? $settings['calendar'] : $this->calendar;
     $settings['langcode'] = !empty($settings['langcode']) ? $settings['langcode'] : $this->langcode;
     $settings['country'] = !empty($settings['country']) ? $settings['country'] : $this->country;
-
+    $settings['format_string_type'] = $format_string_type;

I think this change can be neater. An expanded context is

    $format_string_type = isset($settings['format_string_type']) ? $settings['format_string_type'] : static::PHP;

    $settings['calendar'] = !empty($settings['calendar']) ? $settings['calendar'] : $this->calendar;
    $settings['langcode'] = !empty($settings['langcode']) ? $settings['langcode'] : $this->langcode;
    $settings['country'] = !empty($settings['country']) ? $settings['country'] : $this->country;
    $settings['format_string_type'] = $format_string_type;

So we're assigning $format_string_type based on $settings['format_string_type'] or a default just above. So we could assign $settings['format_string_type'] instead and use it. One less line of code to maintain :)

Attaching patch that does this - since this change is so minor leaving at rtbc.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 5b3ff0d and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

Berdir’s picture

Editing the node form is apparently still broken when using intl and not having datetime.module enabled. See #2031183: Improve test coverage for node authored on widget. Help would be very much welcome.