We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd4b3d3 commit 5e1711fCopy full SHA for 5e1711f
src/Qiniu/Http/Header.php
@@ -264,7 +264,7 @@ public function count()
264
*/
265
private static function isValidKeyName($str)
266
{
267
- for ($i = 0; $i < count($str); $i += 1) {
+ for ($i = 0; $i < strlen($str); $i += 1) {
268
if (!isset(self::$isTokenTable[$str[$i]])) {
269
return false;
270
}
tests/Qiniu/Tests/HeaderTest.php
@@ -40,6 +40,20 @@ public function testNormalizeKey()
40
$this->assertEquals($actual, $except);
41
42
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
57
public function testGetRawData()
58
59
$header = new Header($this->heads);
0 commit comments