php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15952 date and gmdate don't return correct RFC 822 string
Submitted: 2002-03-08 05:54 UTC Modified: 2002-03-09 06:27 UTC
From: soenke at kino-fahrplan dot de Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.0.6 OS: Linux/LFS 2.4.17
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: soenke at kino-fahrplan dot de
New email:
PHP Version: OS:

 

 [2002-03-08 05:54 UTC] soenke at kino-fahrplan dot de
RFC 822 specifies the date string in chapter 5.1 as

  date =  1*2DIGIT month 2DIGIT

2DIGIT is defined to be "exactly <n> occurrences  of (element). Thus 2DIGIT is a 2-digit number" [chapter 2.6].

PHP however returns the day value as one digit only, e.g.:

  Fri,  8 Mar 2002 10:33:37 +0000

This might seem to be a minor issue but actually makes date("r") or gmdate("r") unusable with software that expects two digit days. The Apache server is probably the most important one: creating a conditional request like 

  "If-Modified-Since: " . gmdate("r",$lastmtime)

will for example not work. It will not fail, but Apache won't recognize this date and always return the file, modified or not.

(And yes, Apache's behaviour should be modified, too, making it less picky)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-08 12:25 UTC] sander@php.net
This bug has been fixed in CVS.


 [2002-03-09 06:27 UTC] sander@php.net
1*2DIGIT means 1 or 2 digits, so the old behaviour was correct.
I've reverted my patch; the behaviour hasn't changed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 11:01:30 2024 UTC