Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
system.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Dec 2010 at 22:27 UTC
Updated:
18 Jan 2011 at 01:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
bfroehle commentedAnd a patch.
The visible problem caused by this bug is that _system_date_format_types_build() doesn't return the proper 'module' array keys. What happens is we first query all modules for their custom date formats. Then we ask the database what it knows about -- formats which originate from modules should be preserved, but instead the current code treats everything as originating from the database.
A simple
dpm($types);before and after theblock of code will confirm this.
Comment #2
bfroehle commentedSummary of the issue:
_system_date_format_types_build()builds and returns information about available date types. It first queries modules to determine what date formats they provide, storing the information in$types. It then queries the database about all known date formats, which includes date formats from modules and custom date formats entered manually. The method to determine whether a database$recordis a custom date format (i.e., not from a module) is flawed. The current check is!in_array($record->type, $types)which will always return true since, for example,
$record->typeislong, but$typesis:The proper test would instead be
!isset($types[$record->type]).Solution:
The proposed patch in #1.
Comment #3
jhodgdonThis looks quite reasonable to me. And even an issue summary! +1 for RTBC.
Comment #4
sunThanks.
Comment #5
webchickThis looks like a straight-forward fix that we're unlikely to break again, so I think we're ok not adding tests here. Nice catch.
Committed to HEAD.