Skip Menu |
Report information
Id: 127008
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: zefram [at] fysh.org
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



To: rakudobug [...] perl.org
Date: Wed, 23 Dec 2015 23:50:42 +0000
From: Zefram <zefram [...] fysh.org>
Subject: [BUG] Date.new accepts bogus string input
Download (untitled) / with headers
text/plain 1.1k
The documentation for Date.new says that when given a string input the string is to be in ISO 8601 format. In fact it accepts many kinds of non ISO 8601 strings: "1-01-01" (too few year digits) "2000-1-1" (too few month and day digits) "2000- 01-01" (illegal spaces) "-01-01" (no year digits) "2000-0\x[666]-01" (non-ASCII digit) "2000.5-01-01" (illegal fraction) "2000-001-001" (too many month and day digits) "2000-+01-+01" (sign on month and day) The documentation doesn't actually say that an exception will be thrown when it is given an invalid string input, but it doesn't give any clue as to how non ISO 8601 input would be parsed. Some regexp-based syntax checking would be welcome here. Bearing in mind your response to [perl #127002], perhaps you intend to accept some strings that are not in ISO 8601 format, but the range that is accepted here goes beyond "liberal in what you accept". Many of these strings are quite some distance away from being ISO 8601. Whatever you intend to accept, it would also be wise to document explicitly what happens with non ISO 8601 input. -zefram
Date: Thu, 24 Dec 2015 10:43:47 +0100
Subject: Re: [perl #127008] [BUG] Date.new accepts bogus string input
To: "Zefram (via RT)" <perl6-bugs-followup [...] perl.org>
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Download (untitled) / with headers
text/plain 1.5k
Show quoted text
> On 24 Dec 2015, at 00:50, Zefram (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by Zefram > # Please include the string: [perl #127008] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=127008 > > > > The documentation for Date.new says that when given a string input the > string is to be in ISO 8601 format. In fact it accepts many kinds of > non ISO 8601 strings: > > "1-01-01" (too few year digits) > "2000-1-1" (too few month and day digits) > "2000- 01-01" (illegal spaces) > "-01-01" (no year digits) > "2000-0\x[666]-01" (non-ASCII digit) > "2000.5-01-01" (illegal fraction) > "2000-001-001" (too many month and day digits) > "2000-+01-+01" (sign on month and day) > > The documentation doesn't actually say that an exception will be thrown > when it is given an invalid string input, but it doesn't give any clue > as to how non ISO 8601 input would be parsed. Some regexp-based syntax > checking would be welcome here. > > Bearing in mind your response to [perl #127002], perhaps you intend to > accept some strings that are not in ISO 8601 format, but the range that > is accepted here goes beyond "liberal in what you accept". Many of these > strings are quite some distance away from being ISO 8601. Whatever you > intend to accept, it would also be wise to document explicitly what > happens with non ISO 8601 input.
Fixed as a side-effect of fixing #127010 in fb475d22ba6d5507dd . Can be closed. Liz
Subject: Re: [perl #127008] [BUG] Date.new accepts bogus string input
Date: Thu, 24 Dec 2015 11:04:03 +0000
From: Zefram <zefram [...] fysh.org>
To: Elizabeth Mattijsen via RT <perl6-bugs-followup [...] perl.org>
Download (untitled) / with headers
text/plain 392b
Elizabeth Mattijsen via RT wrote: Show quoted text
>Fixed as a side-effect of fixing #127010 in fb475d22ba6d5507dd . Can be closed.
Not fully fixed. You've fixed most (not all) of the specific cases that I reported, but you left one of them, along with some year formatting that I didn't specifically list. Invalid stuff now accepted: "-0000-01-01" "12345-01-01" "2015-01-0\x[666]" -zefram


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org