summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/chunk_split_variation5.phpt
blob: 9e59d6765877650794a6bf8bd9eb994c4374349b (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 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 p./*.*.passsing.different.intege
0100 72 20 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 r.values.for.'chunklen'.argument
0120 20 74 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 .to.chunk_split().*.'ending'.is.
0140 73 65 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 set.to.'||'.*/..echo."***.Testin
0160 67 20 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 g.chunk_split().:.different.inte
0180 67 65 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 ger.values.for.'chunklen'.***\n"
01a0 3b 0a 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 ;...//Initializing.variables.$en
01c0 64 69 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 ding.=."||";.$str.=."This.contai
01e0 6e 73 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 ns\tand.special.char.&.numbers.1
0200 32 33 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 23.\nIt.also.checks.for.\0.char"
0220 3b 0a 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 ;..//.different.values.for.chunk
0240 6c 65 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 len.$values.=.array.(...0,...1,.
0260 20 20 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 ..-123,..//negative.integer...02
0280 33 34 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 34,..//octal.number...0x1A,..//h
02a0 65 78 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 exadecimal.number...PHP_INT_MAX,
02c0 20 20 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 ..//max.positive.integer.number.
02e0 20 20 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 ..PHP_INT_MAX.*.3,..//integer.ov
0300 65 72 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 erflow...-PHP_INT_MAX.-.1,..//mi
0320 6e 20 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 n.negative.integer..);..for($cou
0340 6e 74 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 nt.=.0;.$count.<.count($values);
0360 20 24 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 .$count++).{...echo."--.Iteratio
0380 6e 20 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 n.$count.--\n";...try.{.....var_
03a0 64 75 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 dump(.chunk_split($str,.$values[
03c0 24 63 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 $count],.$ending).);...}.catch.(
03e0 54 79 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 TypeError.$e).{.....echo.$e->get
0400 4d 65 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 Message(),."\n";...}.catch.(\Val
0420 75 65 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 ueError.$e).{.......echo.$e->get
0440 4d 65 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 Message()..."\n";...}.}..?>.--EX
0460 50 45 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 PECT--.***.Testing.chunk_split()
0480 20 3a 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 .:.different.integer.values.for.
04a0 27 63 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 'chunklen'.***.--.Iteration.0.--
04c0 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 28 24 6c 65 .chunk_split():.Argument.#2.($le
04e0 6e 67 74 68 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 ngth).must.be.greater.than.0.--.
0500 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
0520 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||
0540 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|
0560 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
0580 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||
05a0 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|
05c0 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||.||.
05e0 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.
0600 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.
0620 28 24 6c 65 6e 67 74 68 29 20 6d 75 73 74 20 62 65 20 67 72 65 61 74 65 72 20 74 68 61 6e 20 30 ($length).must.be.greater.than.0
0640 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 22 54 .--.Iteration.3.--.string(73)."T
0660 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 26 20 his.contains.and.special.char.&.
0680 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 72 20 numbers.123..It.also.checks.for.
06a0 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 72 69 ..char||".--.Iteration.4.--.stri
06c0 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 69 61 ng(77)."This.contains.and.specia
06e0 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 7c 7c l.||char.&.numbers.123..It.als||
0700 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 61 74 o.checks.for...char||".--.Iterat
0720 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 61 69 ion.5.--.string(73)."This.contai
0740 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 31 32 ns.and.special.char.&.numbers.12
0760 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 22 0a 3..It.also.checks.for...char||".
0780 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 29 3a --.Iteration.6.--.chunk_split():
07a0 20 41 72 67 75 6d 65 6e 74 20 23 32 20 28 24 6c 65 6e 67 74 68 29 20 6d 75 73 74 20 62 65 20 6f .Argument.#2.($length).must.be.o
07c0 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 74 65 72 61 f.type.int,.float.given.--.Itera
07e0 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 75 6d 65 6e tion.7.--.chunk_split():.Argumen
0800 74 20 23 32 20 28 24 6c 65 6e 67 74 68 29 20 6d 75 73 74 20 62 65 20 67 72 65 61 74 65 72 20 74 t.#2.($length).must.be.greater.t
0820 68 61 6e 20 30 0a han.0.