File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ public function count()
264264 */
265265 private static function isValidKeyName ($ str )
266266 {
267- for ($ i = 0 ; $ i < count ($ str ); $ i += 1 ) {
267+ for ($ i = 0 ; $ i < strlen ($ str ); $ i += 1 ) {
268268 if (!isset (self ::$ isTokenTable [$ str [$ i ]])) {
269269 return false ;
270270 }
Original file line number Diff line number Diff line change @@ -40,6 +40,20 @@ public function testNormalizeKey()
4040 $ this ->assertEquals ($ actual , $ except );
4141 }
4242
43+
44+ public function testInvalidKeyName ()
45+ {
46+ $ except = array (
47+ 'a:x-test-1 ' ,
48+ );
49+
50+ $ actual = array_map (function ($ str ) {
51+ return Header::normalizeKey ($ str );
52+ }, $ except );
53+
54+ $ this ->assertEquals ($ except , $ actual );
55+ }
56+
4357 public function testGetRawData ()
4458 {
4559 $ header = new Header ($ this ->heads );
You can’t perform that action at this time.
0 commit comments