summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/chunk_split_variation5.phpt
blob: e53b1e3240955a200ce2d555941895c52dd55d0b (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 20 20 0a 20 20 31 2c 20 n.$values.=.array.(...0,.....1,.
0320 20 0a 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 ....-123,..//negative.integer...
0340 30 32 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 0234,..//octal.number...0x1A,../
0360 2f 68 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 /hexadecimal.number...PHP_INT_MA
0380 58 2c 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 X,..//max.positive.integer.numbe
03a0 72 0a 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 r...PHP_INT_MAX.*.3,..//integer.
03c0 6f 76 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 overflow...-PHP_INT_MAX.-.1,..//
03e0 6d 69 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 min.negative.integer..);..for($c
0400 6f 75 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 ount.=.0;.$count.<.count($values
0420 29 3b 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 );.$count++).{...echo."--.Iterat
0440 69 6f 6e 20 24 63 6f 75 6e 74 20 2d 2d 5c 6e 22 3b 0a 20 20 76 61 72 5f 64 75 6d 70 28 20 63 68 ion.$count.--\n";...var_dump(.ch
0460 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 6f 75 6e 74 5d 2c unk_split($str,.$values[$count],
0480 20 24 65 6e 64 69 6e 67 29 20 29 3b 0a 7d 0a 0a 65 63 68 6f 20 22 44 6f 6e 65 22 0a 3f 3e 0a 2d .$ending).);.}..echo."Done".?>.-
04a0 2d 45 58 50 45 43 54 46 2d 2d 0a 2a 2a 2a 20 54 65 73 74 69 6e 67 20 63 68 75 6e 6b 5f 73 70 6c -EXPECTF--.***.Testing.chunk_spl
04c0 69 74 28 29 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 it().:.different.integer.values.
04e0 66 6f 72 20 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 for.'chunklen'.***.--.Iteration.
0500 30 20 2d 2d 0a 0a 57 61 72 6e 69 6e 67 3a 20 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 3a 20 43 68 0.--..Warning:.chunk_split():.Ch
0520 75 6e 6b 20 6c 65 6e 67 74 68 20 73 68 6f 75 6c 64 20 62 65 20 67 72 65 61 74 65 72 20 74 68 61 unk.length.should.be.greater.tha
0540 6e 20 7a 65 72 6f 20 69 6e 20 25 73 20 6f 6e 20 6c 69 6e 65 20 25 64 0a 62 6f 6f 6c 28 66 61 6c n.zero.in.%s.on.line.%d.bool(fal
0560 73 65 29 0a 2d 2d 20 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 se).--.Iteration.1.--.string(213
0580 29 20 22 54 7c 7c 68 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 )."T||h||i||s||.||c||o||n||t||a|
05a0 7c 69 7c 7c 6e 7c 7c 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 |i||n||s||.||a||n||d||.||s||p||e
05c0 7c 7c 63 7c 7c 69 7c 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 ||c||i||a||l||.||c||h||a||r||.||
05e0 26 7c 7c 20 7c 7c 6e 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 &||.||n||u||m||b||e||r||s||.||1|
0600 7c 32 7c 7c 33 7c 7c 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 |2||3||.||.||I||t||.||a||l||s||o
0620 7c 7c 20 7c 7c 63 7c 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 ||.||c||h||e||c||k||s||.||f||o||
0640 72 7c 7c 20 7c 7c 00 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 r||.||.||.||c||h||a||r||".--.Ite
0660 72 61 74 69 6f 6e 20 32 20 2d 2d 0a 0a 57 61 72 6e 69 6e 67 3a 20 63 68 75 6e 6b 5f 73 70 6c 69 ration.2.--..Warning:.chunk_spli
0680 74 28 29 3a 20 43 68 75 6e 6b 20 6c 65 6e 67 74 68 20 73 68 6f 75 6c 64 20 62 65 20 67 72 65 61 t():.Chunk.length.should.be.grea
06a0 74 65 72 20 74 68 61 6e 20 7a 65 72 6f 20 69 6e 20 25 73 20 6f 6e 20 6c 69 6e 65 20 25 64 0a 62 ter.than.zero.in.%s.on.line.%d.b
06c0 6f 6f 6c 28 66 61 6c 73 65 29 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 33 20 2d 2d 0a 73 74 72 ool(false).--.Iteration.3.--.str
06e0 69 6e 67 28 37 33 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 ing(73)."This.contains.and.speci
0700 61 6c 20 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 6f 20 63 al.char.&.numbers.123..It.also.c
0720 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 69 6f 6e hecks.for...char||".--.Iteration
0740 20 34 20 2d 2d 0a 73 74 72 69 6e 67 28 37 37 29 20 22 54 68 69 73 20 63 6f 6e 74 61 69 6e 73 09 .4.--.string(77)."This.contains.
0760 61 6e 64 20 73 70 65 63 69 61 6c 20 7c 7c 63 68 61 72 20 26 20 6e 75 6d 62 65 72 73 20 31 32 33 and.special.||char.&.numbers.123
0780 2e 0a 49 74 20 61 6c 73 7c 7c 6f 20 63 68 65 63 6b 73 20 66 6f 72 20 00 20 63 68 61 72 7c 7c 22 ..It.als||o.checks.for...char||"
07a0 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 35 20 2d 2d 0a 73 74 72 69 6e 67 28 37 33 29 20 22 54 .--.Iteration.5.--.string(73)."T
07c0 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.&.
07e0 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.
0800 00 20 63 68 61 72 7c 7c 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 36 20 2d 2d 0a 0a 57 61 72 ..char||".--.Iteration.6.--..War
0820 6e 69 6e 67 3a 20 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 20 65 78 70 65 63 74 73 20 70 61 72 61 ning:.chunk_split().expects.para
0840 6d 65 74 65 72 20 32 20 74 6f 20 62 65 20 69 6e 74 65 67 65 72 2c 20 66 6c 6f 61 74 20 67 69 76 meter.2.to.be.integer,.float.giv
0860 65 6e 20 69 6e 20 25 73 20 6f 6e 20 6c 69 6e 65 20 25 64 0a 4e 55 4c 4c 0a 2d 2d 20 49 74 65 72 en.in.%s.on.line.%d.NULL.--.Iter
0880 61 74 69 6f 6e 20 37 20 2d 2d 0a 0a 57 61 72 6e 69 6e 67 3a 20 63 68 75 6e 6b 5f 73 70 6c 69 74 ation.7.--..Warning:.chunk_split
08a0 28 29 3a 20 43 68 75 6e 6b 20 6c 65 6e 67 74 68 20 73 68 6f 75 6c 64 20 62 65 20 67 72 65 61 74 ():.Chunk.length.should.be.great
08c0 65 72 20 74 68 61 6e 20 7a 65 72 6f 20 69 6e 20 25 73 20 6f 6e 20 6c 69 6e 65 20 25 64 0a 62 6f er.than.zero.in.%s.on.line.%d.bo
08e0 6f 6c 28 66 61 6c 73 65 29 0a 44 6f 6e 65 0a ol(false).Done.