summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/chunk_split_variation5.phpt
blob: 7cdff8c6cdfbd3a2b4f5f7f4821115d9afae222f (plain)
ofshex dumpascii
0000 2d 2d 54 45 53 54 2d 2d 0a 54 65 73 74 20 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 20 66 75 6e 63 --TEST--.Test.chunk_split().func
0020 74 69 6f 6e 20 3a 20 75 73 61 67 65 20 76 61 72 69 61 74 69 6f 6e 73 20 2d 20 64 69 66 66 65 72 tion.:.usage.variations.-.differ
0040 65 6e 74 20 69 6e 74 65 67 65 72 20 76 61 6c 75 65 73 20 66 6f 72 20 27 63 68 75 6e 6b 6c 65 6e ent.integer.values.for.'chunklen
0060 27 20 61 72 67 75 6d 65 6e 74 28 42 75 67 23 34 32 37 39 36 29 0a 2d 2d 53 4b 49 50 49 46 2d 2d '.argument(Bug#42796).--SKIPIF--
0080 0a 3c 3f 70 68 70 0a 69 66 20 28 50 48 50 5f 49 4e 54 5f 53 49 5a 45 20 21 3d 20 38 29 20 64 69 .<?php.if.(PHP_INT_SIZE.!=.8).di
00a0 65 28 22 73 6b 69 70 20 74 68 69 73 20 74 65 73 74 20 69 73 20 66 6f 72 20 36 34 62 69 74 20 70 e("skip.this.test.is.for.64bit.p
00c0 6c 61 74 66 6f 72 6d 20 6f 6e 6c 79 22 29 3b 0a 3f 3e 0a 2d 2d 46 49 4c 45 2d 2d 0a 3c 3f 70 68 latform.only");.?>.--FILE--.<?ph
00e0 70 0a 2f 2a 20 50 72 6f 74 6f 74 79 70 65 20 20 3a 20 73 74 72 69 6e 67 20 63 68 75 6e 6b 5f 73 p./*.Prototype..:.string.chunk_s
0100 70 6c 69 74 28 73 74 72 69 6e 67 20 24 73 74 72 20 5b 2c 20 69 6e 74 20 24 63 68 75 6e 6b 6c 65 plit(string.$str.[,.int.$chunkle
0120 6e 20 5b 2c 20 73 74 72 69 6e 67 20 24 65 6e 64 69 6e 67 5d 5d 29 0a 20 2a 20 44 65 73 63 72 69 n.[,.string.$ending]])..*.Descri
0140 70 74 69 6f 6e 3a 20 52 65 74 75 72 6e 73 20 73 70 6c 69 74 20 6c 69 6e 65 0a 20 2a 20 53 6f 75 ption:.Returns.split.line..*.Sou
0160 72 63 65 20 63 6f 64 65 3a 20 65 78 74 2f 73 74 61 6e 64 61 72 64 2f 73 74 72 69 6e 67 2e 63 0a rce.code:.ext/standard/string.c.
0180 20 2a 20 41 6c 69 61 73 20 74 6f 20 66 75 6e 63 74 69 6f 6e 73 3a 20 6e 6f 6e 65 0a 2a 2f 0a 0a .*.Alias.to.functions:.none.*/..
01a0 2f 2a 0a 2a 20 70 61 73 73 73 69 6e 67 20 64 69 66 66 65 72 65 6e 74 20 69 6e 74 65 67 65 72 20 /*.*.passsing.different.integer.
01c0 76 61 6c 75 65 73 20 66 6f 72 20 27 63 68 75 6e 6b 6c 65 6e 27 20 61 72 67 75 6d 65 6e 74 20 74 values.for.'chunklen'.argument.t
01e0 6f 20 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 0a 2a 20 27 65 6e 64 69 6e 67 27 20 69 73 20 73 65 o.chunk_split().*.'ending'.is.se
0200 74 20 74 6f 20 27 7c 7c 27 0a 2a 2f 0a 0a 65 63 68 6f 20 22 2a 2a 2a 20 54 65 73 74 69 6e 67 20 t.to.'||'.*/..echo."***.Testing.
0220 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 20 3a 20 64 69 66 66 65 72 65 6e 74 20 69 6e 74 65 67 65 chunk_split().:.different.intege
0240 72 20 76 61 6c 75 65 73 20 66 6f 72 20 27 63 68 75 6e 6b 6c 65 6e 27 20 2a 2a 2a 5c 6e 22 3b 0a r.values.for.'chunklen'.***\n";.
0260 0a 20 2f 2f 49 6e 69 74 69 61 6c 69 7a 69 6e 67 20 76 61 72 69 61 62 6c 65 73 0a 24 65 6e 64 69 ..//Initializing.variables.$endi
0280 6e 67 20 3d 20 22 7c 7c 22 3b 0a 24 73 74 72 20 3d 20 22 54 68 69 73 20 63 6f 6e 74 61 69 6e 73 ng.=."||";.$str.=."This.contains
02a0 5c 74 61 6e 64 20 73 70 65 63 69 61 6c 20 63 68 61 72 20 26 20 6e 75 6d 62 65 72 73 20 31 32 33 \tand.special.char.&.numbers.123
02c0 2e 5c 6e 49 74 20 61 6c 73 6f 20 63 68 65 63 6b 73 20 66 6f 72 20 5c 30 20 63 68 61 72 22 3b 0a .\nIt.also.checks.for.\0.char";.
02e0 0a 2f 2f 20 64 69 66 66 65 72 65 6e 74 20 76 61 6c 75 65 73 20 66 6f 72 20 63 68 75 6e 6b 6c 65 .//.different.values.for.chunkle
0300 6e 0a 24 76 61 6c 75 65 73 20 3d 20 61 72 72 61 79 20 28 0a 20 20 30 2c 0a 20 20 31 2c 0a 20 20 n.$values.=.array.(...0,...1,...
0320 2d 31 32 33 2c 20 20 2f 2f 6e 65 67 61 74 69 76 65 20 69 6e 74 65 67 65 72 0a 20 20 30 32 33 34 -123,..//negative.integer...0234
0340 2c 20 20 2f 2f 6f 63 74 61 6c 20 6e 75 6d 62 65 72 0a 20 20 30 78 31 41 2c 20 20 2f 2f 68 65 78 ,..//octal.number...0x1A,..//hex
0360 61 64 65 63 69 6d 61 6c 20 6e 75 6d 62 65 72 0a 20 20 50 48 50 5f 49 4e 54 5f 4d 41 58 2c 20 20 adecimal.number...PHP_INT_MAX,..
0380 2f 2f 6d 61 78 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 65 72 20 6e 75 6d 62 65 72 0a 20 20 //max.positive.integer.number...
03a0 50 48 50 5f 49 4e 54 5f 4d 41 58 20 2a 20 33 2c 20 20 2f 2f 69 6e 74 65 67 65 72 20 6f 76 65 72 PHP_INT_MAX.*.3,..//integer.over
03c0 66 6c 6f 77 0a 20 20 2d 50 48 50 5f 49 4e 54 5f 4d 41 58 20 2d 20 31 2c 20 20 2f 2f 6d 69 6e 20 flow...-PHP_INT_MAX.-.1,..//min.
03e0 6e 65 67 61 74 69 76 65 20 69 6e 74 65 67 65 72 0a 0a 29 3b 0a 0a 66 6f 72 28 24 63 6f 75 6e 74 negative.integer..);..for($count
0400 20 3d 20 30 3b 20 24 63 6f 75 6e 74 20 3c 20 63 6f 75 6e 74 28 24 76 61 6c 75 65 73 29 3b 20 24 .=.0;.$count.<.count($values);.$
0420 63 6f 75 6e 74 2b 2b 29 20 7b 0a 20 20 65 63 68 6f 20 22 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 count++).{...echo."--.Iteration.
0440 24 63 6f 75 6e 74 20 2d 2d 5c 6e 22 3b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 76 61 72 5f 64 75 $count.--\n";...try.{.....var_du
0460 6d 70 28 20 63 68 75 6e 6b 5f 73 70 6c 69 74 28 24 73 74 72 2c 20 24 76 61 6c 75 65 73 5b 24 63 mp(.chunk_split($str,.$values[$c
0480 6f 75 6e 74 5d 2c 20 24 65 6e 64 69 6e 67 29 20 29 3b 0a 20 20 7d 20 63 61 74 63 68 20 28 54 79 ount],.$ending).);...}.catch.(Ty
04a0 70 65 45 72 72 6f 72 20 24 65 29 20 7b 0a 20 20 20 20 65 63 68 6f 20 24 65 2d 3e 67 65 74 4d 65 peError.$e).{.....echo.$e->getMe
04c0 73 73 61 67 65 28 29 2c 20 22 5c 6e 22 3b 0a 20 20 7d 20 63 61 74 63 68 20 28 5c 56 61 6c 75 65 ssage(),."\n";...}.catch.(\Value
04e0 45 72 72 6f 72 20 24 65 29 20 7b 0a 20 20 20 20 20 20 65 63 68 6f 20 24 65 2d 3e 67 65 74 4d 65 Error.$e).{.......echo.$e->getMe
0500 73 73 61 67 65 28 29 20 2e 20 22 5c 6e 22 3b 0a 20 20 7d 0a 7d 0a 0a 3f 3e 0a 2d 2d 45 58 50 45 ssage()..."\n";...}.}..?>.--EXPE
0520 43 54 2d 2d 0a 2a 2a 2a 20 54 65 73 74 69 6e 67 20 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 20 3a CT--.***.Testing.chunk_split().:
0540 20 64 69 66 66 65 72 65 6e 74 20 69 6e 74 65 67 65 72 20 76 61 6c 75 65 73 20 66 6f 72 20 27 63 .different.integer.values.for.'c
0560 68 75 6e 6b 6c 65 6e 27 20 2a 2a 2a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 30 20 2d 2d 0a 63 hunklen'.***.--.Iteration.0.--.c
0580 68 75 6e 6b 5f 73 70 6c 69 74 28 29 3a 20 41 72 67 75 6d 65 6e 74 20 23 32 20 28 24 63 68 75 6e hunk_split():.Argument.#2.($chun
05a0 6b 6c 65 6e 29 20 6d 75 73 74 20 62 65 20 67 72 65 61 74 65 72 20 74 68 61 6e 20 30 0a 2d 2d 20 klen).must.be.greater.than.0.--.
05c0 49 74 65 72 61 74 69 6f 6e 20 31 20 2d 2d 0a 73 74 72 69 6e 67 28 32 31 33 29 20 22 54 7c 7c 68 Iteration.1.--.string(213)."T||h
05e0 7c 7c 69 7c 7c 73 7c 7c 20 7c 7c 63 7c 7c 6f 7c 7c 6e 7c 7c 74 7c 7c 61 7c 7c 69 7c 7c 6e 7c 7c ||i||s||.||c||o||n||t||a||i||n||
0600 73 7c 7c 09 7c 7c 61 7c 7c 6e 7c 7c 64 7c 7c 20 7c 7c 73 7c 7c 70 7c 7c 65 7c 7c 63 7c 7c 69 7c s||.||a||n||d||.||s||p||e||c||i|
0620 7c 61 7c 7c 6c 7c 7c 20 7c 7c 63 7c 7c 68 7c 7c 61 7c 7c 72 7c 7c 20 7c 7c 26 7c 7c 20 7c 7c 6e |a||l||.||c||h||a||r||.||&||.||n
0640 7c 7c 75 7c 7c 6d 7c 7c 62 7c 7c 65 7c 7c 72 7c 7c 73 7c 7c 20 7c 7c 31 7c 7c 32 7c 7c 33 7c 7c ||u||m||b||e||r||s||.||1||2||3||
0660 2e 7c 7c 0a 7c 7c 49 7c 7c 74 7c 7c 20 7c 7c 61 7c 7c 6c 7c 7c 73 7c 7c 6f 7c 7c 20 7c 7c 63 7c .||.||I||t||.||a||l||s||o||.||c|
0680 7c 68 7c 7c 65 7c 7c 63 7c 7c 6b 7c 7c 73 7c 7c 20 7c 7c 66 7c 7c 6f 7c 7c 72 7c 7c 20 7c 7c 00 |h||e||c||k||s||.||f||o||r||.||.
06a0 7c 7c 20 7c 7c 63 7c 7c 68 7c 7c 61 7c 7c 72 7c 7c 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 ||.||c||h||a||r||".--.Iteration.
06c0 32 20 2d 2d 0a 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 3a 20 41 72 67 75 6d 65 6e 74 20 23 32 20 2.--.chunk_split():.Argument.#2.
06e0 28 24 63 68 75 6e 6b 6c 65 6e 29 20 6d 75 73 74 20 62 65 20 67 72 65 61 74 65 72 20 74 68 61 6e ($chunklen).must.be.greater.than
0700 20 30 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 33 20 2d 2d 0a 73 74 72 69 6e 67 28 37 33 29 20 .0.--.Iteration.3.--.string(73).
0720 22 54 68 69 73 20 63 6f 6e 74 61 69 6e 73 09 61 6e 64 20 73 70 65 63 69 61 6c 20 63 68 61 72 20 "This.contains.and.special.char.
0740 26 20 6e 75 6d 62 65 72 73 20 31 32 33 2e 0a 49 74 20 61 6c 73 6f 20 63 68 65 63 6b 73 20 66 6f &.numbers.123..It.also.checks.fo
0760 72 20 00 20 63 68 61 72 7c 7c 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 34 20 2d 2d 0a 73 74 r...char||".--.Iteration.4.--.st
0780 72 69 6e 67 28 37 37 29 20 22 54 68 69 73 20 63 6f 6e 74 61 69 6e 73 09 61 6e 64 20 73 70 65 63 ring(77)."This.contains.and.spec
07a0 69 61 6c 20 7c 7c 63 68 61 72 20 26 20 6e 75 6d 62 65 72 73 20 31 32 33 2e 0a 49 74 20 61 6c 73 ial.||char.&.numbers.123..It.als
07c0 7c 7c 6f 20 63 68 65 63 6b 73 20 66 6f 72 20 00 20 63 68 61 72 7c 7c 22 0a 2d 2d 20 49 74 65 72 ||o.checks.for...char||".--.Iter
07e0 61 74 69 6f 6e 20 35 20 2d 2d 0a 73 74 72 69 6e 67 28 37 33 29 20 22 54 68 69 73 20 63 6f 6e 74 ation.5.--.string(73)."This.cont
0800 61 69 6e 73 09 61 6e 64 20 73 70 65 63 69 61 6c 20 63 68 61 72 20 26 20 6e 75 6d 62 65 72 73 20 ains.and.special.char.&.numbers.
0820 31 32 33 2e 0a 49 74 20 61 6c 73 6f 20 63 68 65 63 6b 73 20 66 6f 72 20 00 20 63 68 61 72 7c 7c 123..It.also.checks.for...char||
0840 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 36 20 2d 2d 0a 63 68 75 6e 6b 5f 73 70 6c 69 74 28 ".--.Iteration.6.--.chunk_split(
0860 29 3a 20 41 72 67 75 6d 65 6e 74 20 23 32 20 28 24 63 68 75 6e 6b 6c 65 6e 29 20 6d 75 73 74 20 ):.Argument.#2.($chunklen).must.
0880 62 65 20 6f 66 20 74 79 70 65 20 69 6e 74 2c 20 66 6c 6f 61 74 20 67 69 76 65 6e 0a 2d 2d 20 49 be.of.type.int,.float.given.--.I
08a0 74 65 72 61 74 69 6f 6e 20 37 20 2d 2d 0a 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 3a 20 41 72 67 teration.7.--.chunk_split():.Arg
08c0 75 6d 65 6e 74 20 23 32 20 28 24 63 68 75 6e 6b 6c 65 6e 29 20 6d 75 73 74 20 62 65 20 67 72 65 ument.#2.($chunklen).must.be.gre
08e0 61 74 65 72 20 74 68 61 6e 20 30 0a ater.than.0.