PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/standard/tests/network/setcookie.phpt ('setcookie() tests')

Script

1: <?php
2: setcookie
('name');
3:
setcookie('name''value');
4:
setcookie('name''space value');
5:
setcookie('name''value'0);
6:
setcookie('name''value'$tsp time() + 5);
7:
setcookie('name''value'$tsn time() - 6);
8:
setcookie('name''value'$tsc time());
9:
setcookie('name''value'0'/path/');
10:
setcookie('name''value'0'''domain.tld');
11:
setcookie('name''value'0''''TRUE);
12:
setcookie('name''value'0''''FALSETRUE);
13:
14:
15:
$expected = array(
16:     
'Set-Cookie: name=',
17:     
'Set-Cookie: name=value',
18:     
'Set-Cookie: name=space+value',
19:     
'Set-Cookie: name=value',
20:     
'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s'$tsp).' GMT; Max-Age=5',
21:     
'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s'$tsn).' GMT; Max-Age=-6',
22:     
'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s'$tsc).' GMT; Max-Age=0',
23:     
'Set-Cookie: name=value; path=/path/',
24:     
'Set-Cookie: name=value; domain=domain.tld',
25:     
'Set-Cookie: name=value; secure',
26:     
'Set-Cookie: name=value; HttpOnly'
27:
);
28:
29:
$headers headers_list();
30: if ((
$i count($expected)) > count($headers))
31: {
32:     echo 
"Fewer headers are being sent than expected - aborting";
33:     return;
34: }
35:
36: do
37: {
38:     if (
strncmp(current($headers), 'Set-Cookie:'11) !== 0)
39:     {
40:         continue;
41:     }
42:
43:     if (
current($headers) === current($expected))
44:     {
45:         
$i--;
46:     }
47:     else
48:     {
49:         echo 
"Header mismatch:\n\tExpected: "
50:             
.current($expected)
51:             .
"\n\tReceived: ".current($headers)."\n";
52:     }
53:
54:     
next($expected);
55: }
56: while (
next($headers) !== FALSE);
57:
58: echo (
$i === 0)
59:     ? 
'OK'
60:     
'A total of '.$i.' errors found.';
61:

Expected

OK

Output

Header mismatch:
	Expected: Set-Cookie: name=value; expires=Mon, 21-Jul-2014 19:12:49 GMT; Max-Age=5
	Received: Set-Cookie: name=value; expires=Mon, 21-Jul-2014 19:12:49 GMT; Max-Age=4
A total of 1 errors found.

Diff

001+ Header mismatch:
001- OK
002+ 	Expected: Set-Cookie: name=value; expires=Mon, 21-Jul-2014 19:12:49 GMT; Max-Age=5
003+ 	Received: Set-Cookie: name=value; expires=Mon, 21-Jul-2014 19:12:49 GMT; Max-Age=4
004+ A total of 1 errors found.

 

Generated at Tue, 22 Jul 2014 01:33:26 +0000 (8 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.