Annotation of embedaddon/php/ext/standard/tests/strings/chunk_split_variation8.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test chunk_split() function : usage variations - different integer values for 'chunklen' with heredoc string as 'str'(Bug#42796)
                      3: --SKIPIF--
                      4: <?php
                      5: if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: /* Prototype  : string chunk_split(string $str [, int $chunklen [, string $ending]])
                     10:  * Description: Returns split line
                     11:  * Source code: ext/standard/string.c
                     12:  * Alias to functions: 
                     13: */
                     14: 
                     15: /*
                     16: * passing different integer values for 'chunklen' and heredoc string for 'str' to chunk_split()
                     17: */
                     18: 
                     19: echo "*** Testing chunk_split() : different 'chunklen' with heredoc 'str' ***\n";
                     20: 
                     21: 
                     22: // Initializing required variables
                     23: //heredoc string as str
                     24: $heredoc_str = <<<EOT
                     25: This's heredoc string with \t and \n white space char.
                     26: It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
                     27: chunk_split()
                     28: EOT;
                     29: 
                     30: $ending = ':::';
                     31: 
                     32: // different values for 'chunklen'
                     33: $values = array (
                     34:   0,  
                     35:   1,  
                     36:   -123,  //negative integer
                     37:   0234,  //octal number
                     38:   0x1A,  //hexadecimal number
                     39:   PHP_INT_MAX,      // max positive integer number
                     40:   PHP_INT_MAX * 3,  // integer overflow
                     41:   -PHP_INT_MAX - 1, // min negative integer
                     42: 
                     43: );
                     44: 
                     45: 
                     46: // loop through each element of values for 'chunklen'
                     47: for($count = 0; $count < count($values); $count++) {
                     48:   echo "-- Iteration ".($count+1). " --\n";
                     49:   var_dump( chunk_split($heredoc_str, $values[$count], $ending) );
                     50: }
                     51: 
                     52: echo "Done"
                     53: ?>
                     54: --EXPECTF--
                     55: *** Testing chunk_split() : different 'chunklen' with heredoc 'str' ***
                     56: -- Iteration 1 --
                     57: 
                     58: Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
                     59: bool(false)
                     60: -- Iteration 2 --
                     61: string(504) "T:::h:::i:::s:::':::s::: :::h:::e:::r:::e:::d:::o:::c::: :::s:::t:::r:::i:::n:::g::: :::w:::i:::t:::h::: :::      ::: :::a:::n:::d::: :::
                     62: ::: :::w:::h:::i:::t:::e::: :::s:::p:::a:::c:::e::: :::c:::h:::a:::r:::.:::
                     63: :::I:::t::: :::h:::a:::s::: :::_:::s:::p:::e:::c:::i:::@:::l::: :::c:::h:::@:::r:::$::: :::2:::2:::2:::2::: :::!:::!:::!:::N:::o:::w::: :::\:::k::: :::a:::s::: :::e:::s:::c:::a:::p:::e::: :::c:::h:::a:::r::: :::t:::o::: :::t:::e:::s:::t:::
                     64: :::c:::h:::u:::n:::k:::_:::s:::p:::l:::i:::t:::(:::):::"
                     65: -- Iteration 3 --
                     66: 
                     67: Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
                     68: bool(false)
                     69: -- Iteration 4 --
                     70: string(129) "This's heredoc string with         and 
                     71:  white space char.
                     72: It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
                     73: chunk_split():::"
                     74: -- Iteration 5 --
                     75: string(141) "This's heredoc string with:::      and 
                     76:  white space char.:::
                     77: It has _speci@l ch@r$ 222:::2 !!!Now \k as escape char::: to test
                     78: chunk_split():::"
                     79: -- Iteration 6 --
                     80: string(129) "This's heredoc string with         and 
                     81:  white space char.
                     82: It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
                     83: chunk_split():::"
                     84: -- Iteration 7 --
                     85: 
                     86: Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
                     87: bool(false)
                     88: -- Iteration 8 --
                     89: 
                     90: Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
                     91: bool(false)
                     92: Done

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