]> granicus.if.org Git - php/commitdiff
Fix failed test with recent glibc
authorRemi Collet <remi@php.net>
Wed, 13 Nov 2013 12:19:10 +0000 (13:19 +0100)
committerRemi Collet <remi@php.net>
Wed, 13 Nov 2013 12:19:10 +0000 (13:19 +0100)
In recent version of strptime glibc upstream has fixed a discrepancy between
documentation and actual behaviour by skipping over the sequence that would match %Z.
See http://repo.or.cz/w/glibc.git/commitdiff/ddc7e412ab252e7360a4357664beb3b5d9c4f42b

So when %Z is used in format
glibc <= 2.18 returns the GMT as unparsed
glibc >= 2.19 returns empty string

Removing %Z from tested format gives the same behavior with all version.

ext/standard/tests/time/strptime_basic.phpt

index 194a78f82b2353da782ddb510d7d00b816f8b15d..30e3e82cc779266ada0eee1ed602b078c821094f 100644 (file)
@@ -24,7 +24,7 @@ $input = "10:00:00 AM July 2 1963";
 $tstamp = strtotime($input);
  
 $str = strftime("%r %B%e %Y %Z", $tstamp);
-var_dump(strptime($str, '%H:%M:%S %p %B %d %Y %Z'));
+var_dump(strptime($str, '%H:%M:%S %p %B %d %Y'));
 
 $str = strftime("%T %D", $tstamp);
 var_dump(strptime($str, '%H:%M:%S %m/%d/%y'));
@@ -55,7 +55,7 @@ array(9) {
   ["tm_yday"]=>
   int(182)
   ["unparsed"]=>
-  string(3) "GMT"
+  string(4) " GMT"
 }
 array(9) {
   ["tm_sec"]=>