Annotation of embedaddon/php/sapi/cgi/tests/011.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: header_remove()
                      3: --SKIPIF--
                      4: <?php include "skipif.inc"; ?>
                      5: --FILE--
                      6: <?php
                      7: 
                      8: include "include.inc";
                      9: 
                     10: $php = get_cgi_path();
                     11: reset_env_vars();
                     12: 
                     13: $f = tempnam(sys_get_temp_dir(), 'cgitest');
                     14: 
                     15: function test($script) {
                     16:        file_put_contents($GLOBALS['f'], $script);
                     17:        $cmd = escapeshellcmd($GLOBALS['php']);
                     18:        $cmd .= ' -n -dreport_zend_debug=0 -dhtml_errors=0 ' . escapeshellarg($GLOBALS['f']);
                     19:        echo "----------\n";
                     20:        echo rtrim($script) . "\n";
                     21:        echo "----------\n";
                     22:        passthru($cmd);
                     23: }
                     24: 
                     25: test('<?php ?>');
                     26: test('<?php header_remove(); ?>');
                     27: test('<?php header_remove("X-Foo"); ?>');
                     28: test('<?php
                     29: header("X-Foo: Bar");
                     30: ?>');
                     31: test('<?php
                     32: header("X-Foo: Bar");
                     33: header("X-Bar: Baz");
                     34: header_remove("X-Foo");
                     35: ?>');
                     36: test('<?php
                     37: header("X-Foo: Bar");
                     38: header_remove("X-Foo: Bar");
                     39: ?>');
                     40: test('<?php
                     41: header("X-Foo: Bar");
                     42: header_remove("X-Foo:");
                     43: ?>');
                     44: test('<?php
                     45: header("X-Foo: Bar");
                     46: header_remove();
                     47: ?>');
                     48: test('<?php
                     49: header_remove("");
                     50: ?>');
                     51: test('<?php
                     52: header_remove(":");
                     53: ?>');
                     54: test('<?php
                     55: header("X-Foo: Bar");
                     56: echo "flush\n";
                     57: flush();
                     58: header_remove("X-Foo");
                     59: ?>');
                     60: 
                     61: @unlink($f);
                     62: ?>
                     63: --EXPECTF--
                     64: ----------
                     65: <?php ?>
                     66: ----------
                     67: X-Powered-By: PHP/%s
                     68: Content-type: text/html
                     69: 
                     70: ----------
                     71: <?php header_remove(); ?>
                     72: ----------
                     73: Content-type: text/html
                     74: 
                     75: ----------
                     76: <?php header_remove("X-Foo"); ?>
                     77: ----------
                     78: X-Powered-By: PHP/%s
                     79: Content-type: text/html
                     80: 
                     81: ----------
                     82: <?php
                     83: header("X-Foo: Bar");
                     84: ?>
                     85: ----------
                     86: X-Powered-By: PHP/%s
                     87: X-Foo: Bar
                     88: Content-type: text/html
                     89: 
                     90: ----------
                     91: <?php
                     92: header("X-Foo: Bar");
                     93: header("X-Bar: Baz");
                     94: header_remove("X-Foo");
                     95: ?>
                     96: ----------
                     97: X-Powered-By: PHP/%s
                     98: X-Bar: Baz
                     99: Content-type: text/html
                    100: 
                    101: ----------
                    102: <?php
                    103: header("X-Foo: Bar");
                    104: header_remove("X-Foo: Bar");
                    105: ?>
                    106: ----------
                    107: X-Powered-By: PHP/%s
                    108: X-Foo: Bar
                    109: Content-type: text/html
                    110: 
                    111: 
                    112: Warning: Header to delete may not contain colon. in %s on line 3
                    113: ----------
                    114: <?php
                    115: header("X-Foo: Bar");
                    116: header_remove("X-Foo:");
                    117: ?>
                    118: ----------
                    119: X-Powered-By: PHP/%s
                    120: X-Foo: Bar
                    121: Content-type: text/html
                    122: 
                    123: 
                    124: Warning: Header to delete may not contain colon. in %s on line 3
                    125: ----------
                    126: <?php
                    127: header("X-Foo: Bar");
                    128: header_remove();
                    129: ?>
                    130: ----------
                    131: Content-type: text/html
                    132: 
                    133: ----------
                    134: <?php
                    135: header_remove("");
                    136: ?>
                    137: ----------
                    138: X-Powered-By: PHP/%s
                    139: Content-type: text/html
                    140: 
                    141: ----------
                    142: <?php
                    143: header_remove(":");
                    144: ?>
                    145: ----------
                    146: X-Powered-By: PHP/%s
                    147: Content-type: text/html
                    148: 
                    149: 
                    150: Warning: Header to delete may not contain colon. in %s on line 2
                    151: ----------
                    152: <?php
                    153: header("X-Foo: Bar");
                    154: echo "flush\n";
                    155: flush();
                    156: header_remove("X-Foo");
                    157: ?>
                    158: ----------
                    159: X-Powered-By: PHP/%s
                    160: X-Foo: Bar
                    161: Content-type: text/html
                    162: 
                    163: flush
                    164: 
                    165: Warning: Cannot modify header information - headers already sent by (output started at %s:3) in %s on line 5

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>