Annotation of embedaddon/php/tests/output/ob_start_basic_004.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: ob_start() chunk_size: confirm buffer is flushed after any output call that causes its length to equal or exceed chunk_size.
        !             3: --FILE--
        !             4: <?php
        !             5: /* 
        !             6:  * proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
        !             7:  * Function is implemented in main/output.c
        !             8: */ 
        !             9: 
        !            10: function callback($string) {
        !            11:        global $callback_invocations;
        !            12:        $callback_invocations++;
        !            13:        $len = strlen($string);
        !            14:        return "f[call:$callback_invocations; len:$len]$string\n";
        !            15: }
        !            16: 
        !            17: for ($cs=-1; $cs<10; $cs++) {
        !            18:   echo "\n----( chunk_size: $cs, output append size: 1 )----\n";
        !            19:   $callback_invocations=0;
        !            20:   ob_start('callback', $cs);
        !            21:   echo '1'; echo '2'; echo '3'; echo '4'; echo '5'; echo '6'; echo '7'; echo '8';
        !            22:   ob_end_flush();
        !            23: }
        !            24: 
        !            25: for ($cs=-1; $cs<10; $cs++) {
        !            26:   echo "\n----( chunk_size: $cs, output append size: 4 )----\n";
        !            27:   $callback_invocations=0;
        !            28:   ob_start('callback', $cs);
        !            29:   echo '1234'; echo '5678';
        !            30:   ob_end_flush();
        !            31: }
        !            32: 
        !            33: ?>
        !            34: --EXPECTF--
        !            35: 
        !            36: ----( chunk_size: -1, output append size: 1 )----
        !            37: f[call:1; len:8]12345678
        !            38: 
        !            39: ----( chunk_size: 0, output append size: 1 )----
        !            40: f[call:1; len:8]12345678
        !            41: 
        !            42: ----( chunk_size: 1, output append size: 1 )----
        !            43: f[call:1; len:8]12345678
        !            44: 
        !            45: ----( chunk_size: 2, output append size: 1 )----
        !            46: f[call:1; len:2]12
        !            47: f[call:2; len:2]34
        !            48: f[call:3; len:2]56
        !            49: f[call:4; len:2]78
        !            50: f[call:5; len:0]
        !            51: 
        !            52: ----( chunk_size: 3, output append size: 1 )----
        !            53: f[call:1; len:3]123
        !            54: f[call:2; len:3]456
        !            55: f[call:3; len:2]78
        !            56: 
        !            57: ----( chunk_size: 4, output append size: 1 )----
        !            58: f[call:1; len:4]1234
        !            59: f[call:2; len:4]5678
        !            60: f[call:3; len:0]
        !            61: 
        !            62: ----( chunk_size: 5, output append size: 1 )----
        !            63: f[call:1; len:5]12345
        !            64: f[call:2; len:3]678
        !            65: 
        !            66: ----( chunk_size: 6, output append size: 1 )----
        !            67: f[call:1; len:6]123456
        !            68: f[call:2; len:2]78
        !            69: 
        !            70: ----( chunk_size: 7, output append size: 1 )----
        !            71: f[call:1; len:7]1234567
        !            72: f[call:2; len:1]8
        !            73: 
        !            74: ----( chunk_size: 8, output append size: 1 )----
        !            75: f[call:1; len:8]12345678
        !            76: f[call:2; len:0]
        !            77: 
        !            78: ----( chunk_size: 9, output append size: 1 )----
        !            79: f[call:1; len:8]12345678
        !            80: 
        !            81: ----( chunk_size: -1, output append size: 4 )----
        !            82: f[call:1; len:8]12345678
        !            83: 
        !            84: ----( chunk_size: 0, output append size: 4 )----
        !            85: f[call:1; len:8]12345678
        !            86: 
        !            87: ----( chunk_size: 1, output append size: 4 )----
        !            88: f[call:1; len:8]12345678
        !            89: 
        !            90: ----( chunk_size: 2, output append size: 4 )----
        !            91: f[call:1; len:4]1234
        !            92: f[call:2; len:4]5678
        !            93: f[call:3; len:0]
        !            94: 
        !            95: ----( chunk_size: 3, output append size: 4 )----
        !            96: f[call:1; len:4]1234
        !            97: f[call:2; len:4]5678
        !            98: f[call:3; len:0]
        !            99: 
        !           100: ----( chunk_size: 4, output append size: 4 )----
        !           101: f[call:1; len:4]1234
        !           102: f[call:2; len:4]5678
        !           103: f[call:3; len:0]
        !           104: 
        !           105: ----( chunk_size: 5, output append size: 4 )----
        !           106: f[call:1; len:8]12345678
        !           107: f[call:2; len:0]
        !           108: 
        !           109: ----( chunk_size: 6, output append size: 4 )----
        !           110: f[call:1; len:8]12345678
        !           111: f[call:2; len:0]
        !           112: 
        !           113: ----( chunk_size: 7, output append size: 4 )----
        !           114: f[call:1; len:8]12345678
        !           115: f[call:2; len:0]
        !           116: 
        !           117: ----( chunk_size: 8, output append size: 4 )----
        !           118: f[call:1; len:8]12345678
        !           119: f[call:2; len:0]
        !           120: 
        !           121: ----( chunk_size: 9, output append size: 4 )----
        !           122: f[call:1; len:8]12345678

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