php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65554 createFromFormat broken when weekday name is followed by some delimiters
Submitted: 2013-08-25 22:01 UTC Modified: -
From: stas@php.net Assigned:
Status: Closed Package: Date/time related
PHP Version: 5.4.19 OS: *
Private report: No CVE-ID: None
 [2013-08-25 22:01 UTC] stas@php.net
Description:
------------
createFromFormat fails when in the format D or l is followed by separators that 
are not space or comma. 

Test script:
---------------
$string = "Thu., Nov. 29, 2012 5:00PM";

$data = DateTime::createFromFormat( "D., M# j, Y g:iA", $string );

var_dump( $data );
var_dump( DateTime::getLastErrors() );

Expected result:
----------------
object(DateTime)#1 (3) {
  ["date"]=>
  string(19) "2012-11-29 17:00:00"
  ["timezone_type"]=>
  int(3)
  ["timezone"]=>
  string(19) "America/Los_Angeles"
}
array(4) {
  ["warning_count"]=>
  int(0)
  ["warnings"]=>
  array(0) {
  }
  ["error_count"]=>
  int(0)
  ["errors"]=>
  array(0) {
  }
}


Actual result:
--------------
bool(false)
array(4) {
  ["warning_count"]=>
  int(0)
  ["warnings"]=>
  array(0) {
  }
  ["error_count"]=>
  int(2)
  ["errors"]=>
  array(2) {
    [0]=>
    string(32) "A textual day could not be found"
    [4]=>
    string(40) "The separation symbol could not be found"
  }
}


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-25 22:15 UTC] stas@php.net
Automatic comment on behalf of vlogvinskiy@cogniance.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e6424d89e9419e610ea95484081b9c26b0a7c044
Log: Fix bug #65554 in DateTime, when use it with D/l in format and textual day have dot at the end
 [2013-08-25 22:15 UTC] stas@php.net
-Status: Open +Status: Closed
 [2014-08-22 07:07 UTC] ab@php.net
Automatic comment on behalf of vlogvinskiy@cogniance.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=62b0f1d0fc79d98ddf03eacb5be0d0faabd992a0
Log: Fix bug #65554 in DateTime, when use it with D/l in format and textual day have dot at the end
 [2014-10-07 23:17 UTC] stas@php.net
Automatic comment on behalf of vlogvinskiy@cogniance.com
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=e6424d89e9419e610ea95484081b9c26b0a7c044
Log: Fix bug #65554 in DateTime, when use it with D/l in format and textual day have dot at the end
 [2014-10-07 23:28 UTC] stas@php.net
Automatic comment on behalf of vlogvinskiy@cogniance.com
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=e6424d89e9419e610ea95484081b9c26b0a7c044
Log: Fix bug #65554 in DateTime, when use it with D/l in format and textual day have dot at the end
 [2016-07-20 11:41 UTC] davey@php.net
Automatic comment on behalf of vlogvinskiy@cogniance.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=62b0f1d0fc79d98ddf03eacb5be0d0faabd992a0
Log: Fix bug #65554 in DateTime, when use it with D/l in format and textual day have dot at the end
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 05:01:27 2024 UTC