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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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: Mon May 06 09:01:30 2024 UTC