summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/stripslashes_basic.phpt
blob: 548aee5376ce017ac1866859dafcb9af3107c1ed (plain)
ofshex dumpascii
0000 2d 2d 54 45 53 54 2d 2d 0a 54 65 73 74 20 73 74 72 69 70 73 6c 61 73 68 65 73 28 29 20 66 75 6e --TEST--.Test.stripslashes().fun
0020 63 74 69 6f 6e 20 3a 20 62 61 73 69 63 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 0a 2d 2d 46 ction.:.basic.functionality..--F
0040 49 4c 45 2d 2d 0a 3c 3f 70 68 70 0a 2f 2a 20 50 72 6f 74 6f 74 79 70 65 20 20 3a 20 73 74 72 69 ILE--.<?php./*.Prototype..:.stri
0060 6e 67 20 73 74 72 69 70 73 6c 61 73 68 65 73 20 28 20 73 74 72 69 6e 67 20 24 73 74 72 20 29 0a ng.stripslashes.(.string.$str.).
0080 20 2a 20 44 65 73 63 72 69 70 74 69 6f 6e 3a 20 55 6e 2d 71 75 6f 74 65 73 20 61 20 71 75 6f 74 .*.Description:.Un-quotes.a.quot
00a0 65 64 20 73 74 72 69 6e 67 20 0a 20 2a 20 53 6f 75 72 63 65 20 63 6f 64 65 3a 20 65 78 74 2f 73 ed.string...*.Source.code:.ext/s
00c0 74 61 6e 64 61 72 64 2f 73 74 72 69 6e 67 2e 63 0a 2a 2f 0a 0a 2f 2a 0a 20 2a 20 54 65 73 74 69 tandard/string.c.*/../*..*.Testi
00e0 6e 67 20 73 74 72 69 70 73 6c 61 73 68 65 73 28 29 20 77 69 74 68 20 71 75 6f 74 65 64 20 73 74 ng.stripslashes().with.quoted.st
0100 72 69 6e 67 73 20 0a 2a 2f 0a 0a 65 63 68 6f 20 22 2a 2a 2a 20 54 65 73 74 69 6e 67 20 73 74 72 rings..*/..echo."***.Testing.str
0120 69 70 73 6c 61 73 68 65 73 28 29 20 3a 20 62 61 73 69 63 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 ipslashes().:.basic.functionalit
0140 79 20 2a 2a 2a 5c 6e 22 3b 0a 0a 2f 2f 20 49 6e 69 74 69 61 6c 69 7a 65 20 61 6c 6c 20 72 65 71 y.***\n";..//.Initialize.all.req
0160 75 69 72 65 64 20 76 61 72 69 61 62 6c 65 73 0a 24 73 74 72 5f 61 72 72 61 79 20 3d 20 61 72 72 uired.variables.$str_array.=.arr
0180 61 79 28 20 22 48 6f 77 27 73 20 65 76 65 72 79 62 6f 64 79 22 2c 20 20 20 2f 2f 20 73 74 72 69 ay(."How's.everybody",...//.stri
01a0 6e 67 20 63 6f 6e 74 61 69 6e 69 6e 67 20 73 69 6e 67 6c 65 20 71 75 6f 74 65 0a 20 20 20 20 20 ng.containing.single.quote......
01c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 41 72 65 20 79 6f 75 20 22 4a 4f 48 4e 22 3f 27 ...............'Are.you."JOHN"?'
01e0 2c 20 20 20 2f 2f 20 73 74 72 69 6e 67 20 77 69 74 68 20 64 6f 75 62 6c 65 20 71 75 6f 74 65 73 ,...//.string.with.double.quotes
0200 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 63 3a 5c 70 68 70 5c 73 74 72 .....................'c:\php\str
0220 69 70 73 6c 61 73 68 65 73 27 2c 20 20 20 2f 2f 20 73 74 72 69 6e 67 20 77 69 74 68 20 62 61 63 ipslashes',...//.string.with.bac
0240 6b 73 6c 61 73 68 65 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 63 3a kslashes.....................'c:
0260 5c 5c 70 68 70 5c 5c 73 74 72 69 70 73 6c 61 73 68 65 73 27 2c 20 20 20 2f 2f 20 73 74 72 69 6e \\php\\stripslashes',...//.strin
0280 67 20 77 69 74 68 20 64 6f 75 62 6c 65 20 62 61 63 6b 73 6c 61 73 68 65 73 0a 20 20 20 20 20 20 g.with.double.backslashes.......
02a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 68 65 6c 6c 6f 5c 30 77 6f 72 6c 64 22 20 20 20 2f .............."hello\0world".../
02c0 2f 20 73 74 72 69 6e 67 20 77 69 74 68 20 6e 75 6c 20 63 68 61 72 61 63 74 65 72 0a 20 20 20 20 /.string.with.nul.character.....
02e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 29 3b 0a 0a 2f 2f 20 43 61 6c 6c 69 6e 67 20 73 74 72 ..............);..//.Calling.str
0300 69 70 6c 61 73 68 65 73 28 29 20 77 69 74 68 20 61 6c 6c 20 61 72 67 75 6d 65 6e 74 73 0a 66 6f iplashes().with.all.arguments.fo
0320 72 65 61 63 68 28 20 24 73 74 72 5f 61 72 72 61 79 20 61 73 20 24 73 74 72 20 29 20 20 7b 0a 20 reach(.$str_array.as.$str.)..{..
0340 20 24 73 74 72 5f 61 64 64 73 6c 61 73 68 65 73 20 3d 20 61 64 64 73 6c 61 73 68 65 73 28 24 73 .$str_addslashes.=.addslashes($s
0360 74 72 29 3b 0a 20 20 76 61 72 5f 64 75 6d 70 28 22 54 68 65 20 73 74 72 69 6e 67 20 61 66 74 65 tr);...var_dump("The.string.afte
0380 72 20 61 64 64 73 6c 61 73 68 65 73 20 69 73 3a 22 2c 20 24 73 74 72 5f 61 64 64 73 6c 61 73 68 r.addslashes.is:",.$str_addslash
03a0 65 73 29 3b 0a 20 20 24 73 74 72 5f 73 74 72 69 70 73 6c 61 73 68 65 73 20 3d 20 73 74 72 69 70 es);...$str_stripslashes.=.strip
03c0 73 6c 61 73 68 65 73 28 24 73 74 72 5f 61 64 64 73 6c 61 73 68 65 73 29 3b 0a 20 20 76 61 72 5f slashes($str_addslashes);...var_
03e0 64 75 6d 70 28 22 54 68 65 20 73 74 72 69 6e 67 20 61 66 74 65 72 20 73 74 72 69 70 73 6c 61 73 dump("The.string.after.stripslas
0400 68 65 73 20 69 73 3a 22 2c 20 24 73 74 72 5f 73 74 72 69 70 73 6c 61 73 68 65 73 29 3b 0a 20 20 hes.is:",.$str_stripslashes);...
0420 69 66 28 20 73 74 72 63 6d 70 28 24 73 74 72 2c 20 24 73 74 72 5f 73 74 72 69 70 73 6c 61 73 68 if(.strcmp($str,.$str_stripslash
0440 65 73 29 20 21 3d 20 30 20 29 0a 20 20 20 20 65 63 68 6f 20 22 5c 6e 45 72 72 6f 72 3a 20 4f 72 es).!=.0.).....echo."\nError:.Or
0460 69 67 69 6e 61 6c 20 73 74 72 69 6e 67 20 61 6e 64 20 73 74 72 69 6e 67 20 61 66 74 65 72 20 73 iginal.string.and.string.after.s
0480 74 72 69 70 73 6c 61 73 68 65 73 20 64 6f 6e 6f 74 20 6d 61 74 63 68 5c 6e 22 3b 0a 7d 0a 0a 65 tripslashes.donot.match\n";.}..e
04a0 63 68 6f 20 22 44 6f 6e 65 5c 6e 22 3b 0a 3f 3e 0a 2d 2d 45 58 50 45 43 54 46 2d 2d 0a 2a 2a 2a cho."Done\n";.?>.--EXPECTF--.***
04c0 20 54 65 73 74 69 6e 67 20 73 74 72 69 70 73 6c 61 73 68 65 73 28 29 20 3a 20 62 61 73 69 63 20 .Testing.stripslashes().:.basic.
04e0 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 2a 2a 2a 0a 73 74 72 69 6e 67 28 33 31 29 20 22 54 68 functionality.***.string(31)."Th
0500 65 20 73 74 72 69 6e 67 20 61 66 74 65 72 20 61 64 64 73 6c 61 73 68 65 73 20 69 73 3a 22 0a 73 e.string.after.addslashes.is:".s
0520 74 72 69 6e 67 28 31 36 29 20 22 48 6f 77 5c 27 73 20 65 76 65 72 79 62 6f 64 79 22 0a 73 74 72 tring(16)."How\'s.everybody".str
0540 69 6e 67 28 33 33 29 20 22 54 68 65 20 73 74 72 69 6e 67 20 61 66 74 65 72 20 73 74 72 69 70 73 ing(33)."The.string.after.strips
0560 6c 61 73 68 65 73 20 69 73 3a 22 0a 73 74 72 69 6e 67 28 31 35 29 20 22 48 6f 77 27 73 20 65 76 lashes.is:".string(15)."How's.ev
0580 65 72 79 62 6f 64 79 22 0a 73 74 72 69 6e 67 28 33 31 29 20 22 54 68 65 20 73 74 72 69 6e 67 20 erybody".string(31)."The.string.
05a0 61 66 74 65 72 20 61 64 64 73 6c 61 73 68 65 73 20 69 73 3a 22 0a 73 74 72 69 6e 67 28 31 37 29 after.addslashes.is:".string(17)
05c0 20 22 41 72 65 20 79 6f 75 20 5c 22 4a 4f 48 4e 5c 22 3f 22 0a 73 74 72 69 6e 67 28 33 33 29 20 ."Are.you.\"JOHN\"?".string(33).
05e0 22 54 68 65 20 73 74 72 69 6e 67 20 61 66 74 65 72 20 73 74 72 69 70 73 6c 61 73 68 65 73 20 69 "The.string.after.stripslashes.i
0600 73 3a 22 0a 73 74 72 69 6e 67 28 31 35 29 20 22 41 72 65 20 79 6f 75 20 22 4a 4f 48 4e 22 3f 22 s:".string(15)."Are.you."JOHN"?"
0620 0a 73 74 72 69 6e 67 28 33 31 29 20 22 54 68 65 20 73 74 72 69 6e 67 20 61 66 74 65 72 20 61 64 .string(31)."The.string.after.ad
0640 64 73 6c 61 73 68 65 73 20 69 73 3a 22 0a 73 74 72 69 6e 67 28 32 31 29 20 22 63 3a 5c 5c 70 68 dslashes.is:".string(21)."c:\\ph
0660 70 5c 5c 73 74 72 69 70 73 6c 61 73 68 65 73 22 0a 73 74 72 69 6e 67 28 33 33 29 20 22 54 68 65 p\\stripslashes".string(33)."The
0680 20 73 74 72 69 6e 67 20 61 66 74 65 72 20 73 74 72 69 70 73 6c 61 73 68 65 73 20 69 73 3a 22 0a .string.after.stripslashes.is:".
06a0 73 74 72 69 6e 67 28 31 39 29 20 22 63 3a 5c 70 68 70 5c 73 74 72 69 70 73 6c 61 73 68 65 73 22 string(19)."c:\php\stripslashes"
06c0 0a 73 74 72 69 6e 67 28 33 31 29 20 22 54 68 65 20 73 74 72 69 6e 67 20 61 66 74 65 72 20 61 64 .string(31)."The.string.after.ad
06e0 64 73 6c 61 73 68 65 73 20 69 73 3a 22 0a 73 74 72 69 6e 67 28 32 31 29 20 22 63 3a 5c 5c 70 68 dslashes.is:".string(21)."c:\\ph
0700 70 5c 5c 73 74 72 69 70 73 6c 61 73 68 65 73 22 0a 73 74 72 69 6e 67 28 33 33 29 20 22 54 68 65 p\\stripslashes".string(33)."The
0720 20 73 74 72 69 6e 67 20 61 66 74 65 72 20 73 74 72 69 70 73 6c 61 73 68 65 73 20 69 73 3a 22 0a .string.after.stripslashes.is:".
0740 73 74 72 69 6e 67 28 31 39 29 20 22 63 3a 5c 70 68 70 5c 73 74 72 69 70 73 6c 61 73 68 65 73 22 string(19)."c:\php\stripslashes"
0760 0a 73 74 72 69 6e 67 28 33 31 29 20 22 54 68 65 20 73 74 72 69 6e 67 20 61 66 74 65 72 20 61 64 .string(31)."The.string.after.ad
0780 64 73 6c 61 73 68 65 73 20 69 73 3a 22 0a 73 74 72 69 6e 67 28 31 32 29 20 22 68 65 6c 6c 6f 5c dslashes.is:".string(12)."hello\
07a0 30 77 6f 72 6c 64 22 0a 73 74 72 69 6e 67 28 33 33 29 20 22 54 68 65 20 73 74 72 69 6e 67 20 61 0world".string(33)."The.string.a
07c0 66 74 65 72 20 73 74 72 69 70 73 6c 61 73 68 65 73 20 69 73 3a 22 0a 73 74 72 69 6e 67 28 31 31 fter.stripslashes.is:".string(11
07e0 29 20 22 68 65 6c 6c 6f 00 77 6f 72 6c 64 22 0a 44 6f 6e 65 )."hello.world".Done