@@ -100,7 +100,7 @@ public function testShouldParseEnclosedCharacters()
100100
101101 public function testShouldParseVariousNcValueFormatting ()
102102 {
103- $ nc = 42 ;
103+ $ nc = hexdec ( ' 00000042 ' ) ;
104104
105105 $ auth = AuthHeader::parse ([
106106 'Digest realm="sip.domain.net",qop="auth",nonce="7900f98e-3d80-4504-adbc-a61e5e040207",stale=FALSE,algorithm=MD5,nc=42 ' ,
@@ -114,7 +114,7 @@ public function testShouldParseVariousNcValueFormatting()
114114 $ count = count ($ auth ->values );
115115
116116 for ($ i = 0 ; $ i < $ count ; $ i ++) {
117- $ this ->assertEquals ($ nc , $ auth ->values [$ i ]->nc );
117+ $ this ->assertEquals ($ nc , hexdec ( $ auth ->values [$ i ]->nc ) );
118118 }
119119 }
120120
@@ -170,15 +170,15 @@ public function testShouldRenderWellFormedValues()
170170 $ digest ->values [0 ]->algorithm = 'MD5 ' ;
171171 $ digest ->values [0 ]->cnonce = '7900f98e ' ;
172172 $ digest ->values [0 ]->qop = 'auth-int ' ;
173- $ digest ->values [0 ]->nc = 42 ;
173+ $ digest ->values [0 ]->nc = ' 42 ' ;
174174 $ digest ->values [0 ]->opaque = 'misc ' ;
175175
176176 $ rendered = $ digest ->render ('Authorization ' );
177177
178178 $ this ->assertNotNull ($ rendered );
179179 $ this ->assertIsString ($ rendered );
180180 $ this ->assertEquals (
181- 'Authorization: Digest username="bob",realm="sip.domain.net",domain="sip:sip.domain.net",nonce="a61e5e040207",uri="sip:sip.domain.net",response="KJHAFgHFIUAG",stale=TRUE,algorithm="MD5",cnonce="7900f98e",qop="auth-int",ns =00000042,opaque="misc" ' . "\r\n" ,
181+ 'Authorization: Digest username="bob",realm="sip.domain.net",domain="sip:sip.domain.net",nonce="a61e5e040207",uri="sip:sip.domain.net",response="KJHAFgHFIUAG",stale=TRUE,algorithm="MD5",cnonce="7900f98e",qop="auth-int",nc =00000042,opaque="misc" ' . "\r\n" ,
182182 $ rendered
183183 );
184184
@@ -204,7 +204,7 @@ public function testShouldRenderWellFormedValues()
204204 $ this ->assertNotNull ($ rendered );
205205 $ this ->assertIsString ($ rendered );
206206 $ this ->assertEquals (
207- 'Authorization: Digest username="bob",realm="sip.domain.net",domain="sip:sip.domain.net",nonce="a61e5e040207",uri="sip:sip.domain.net",response="KJHAFgHFIUAG",stale=TRUE,algorithm="MD5",cnonce="7900f98e",qop="auth-int",ns =00000042,opaque="misc" ' . "\r\n" .
207+ 'Authorization: Digest username="bob",realm="sip.domain.net",domain="sip:sip.domain.net",nonce="a61e5e040207",uri="sip:sip.domain.net",response="KJHAFgHFIUAG",stale=TRUE,algorithm="MD5",cnonce="7900f98e",qop="auth-int",nc =00000042,opaque="misc" ' . "\r\n" .
208208 'Authorization: Basic MiScCreds ' . "\r\n" ,
209209 $ rendered
210210 );
0 commit comments