summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/stripslashes_basic.phpt
blob: 3e0fb6f2ab9f9a7e3385a902b4a04b3bcb140166 (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 0a 2d 2d 46 49 ction.:.basic.functionality.--FI
0040 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 6e LE--.<?php./*.Prototype..:.strin
0060 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 20 g.stripslashes.(.string.$str.)..
0080 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 65 *.Description:.Un-quotes.a.quote
00a0 64 20 73 74 72 69 6e 67 0a 20 2a 20 53 6f 75 72 63 65 20 63 6f 64 65 3a 20 65 78 74 2f 73 74 61 d.string..*.Source.code:.ext/sta
00c0 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 6e 67 ndard/string.c.*/../*..*.Testing
00e0 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 72 69 .stripslashes().with.quoted.stri
0100 6e 67 73 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 69 70 73 ngs.*/..echo."***.Testing.strips
0120 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 79 20 2a lashes().:.basic.functionality.*
0140 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 75 69 72 **\n";..//.Initialize.all.requir
0160 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 61 79 28 ed.variables.$str_array.=.array(
0180 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 6e 67 20 ."How's.everybody",...//.string.
01a0 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 20 20 20 containing.single.quote.........
01c0 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 2c 20 20 ............'Are.you."JOHN"?',..
01e0 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 0a 20 20 .//.string.with.double.quotes...
0200 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 69 70 73 ..................'c:\php\strips
0220 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 6b 73 6c lashes',...//.string.with.backsl
0240 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 5c 5c 70 ashes.....................'c:\\p
0260 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 67 20 77 hp\\stripslashes',...//.string.w
0280 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 20 20 20 ith.double.backslashes..........
02a0 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 2f 20 73 ..........."hello\0world"...//.s
02c0 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 20 20 20 tring.with.nul.character........
02e0 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 69 70 6c ...........);..//.Calling.stripl
0300 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 72 65 61 ashes().with.all.arguments.forea
0320 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 20 24 73 ch(.$str_array.as.$str.)..{...$s
0340 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 74 72 29 tr_addslashes.=.addslashes($str)
0360 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 72 20 61 ;...var_dump("The.string.after.a
0380 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 65 73 29 ddslashes.is:",.$str_addslashes)
03a0 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 73 6c 61 ;...$str_stripslashes.=.stripsla
03c0 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 64 75 6d shes($str_addslashes);...var_dum
03e0 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 68 65 73 p("The.string.after.stripslashes
0400 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 69 66 28 .is:",.$str_stripslashes);...if(
0420 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 65 73 29 .strcmp($str,.$str_stripslashes)
0440 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 69 67 69 .!=.0.).....echo."\nError:.Origi
0460 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 74 72 69 nal.string.and.string.after.stri
0480 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 63 68 6f pslashes.donot.match\n";.}..echo
04a0 20 22 44 6f 6e 65 5c 6e 22 3b 0a 3f 3e 0a 2d 2d 45 58 50 45 43 54 2d 2d 0a 2a 2a 2a 20 54 65 73 ."Done\n";.?>.--EXPECT--.***.Tes
04c0 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 66 75 6e 63 ting.stripslashes().:.basic.func
04e0 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 65 20 73 74 tionality.***.string(31)."The.st
0500 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 74 72 69 6e ring.after.addslashes.is:".strin
0520 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 69 6e 67 28 g(16)."How\'s.everybody".string(
0540 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 6c 61 73 68 33)."The.string.after.stripslash
0560 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 65 72 79 62 es.is:".string(15)."How's.everyb
0580 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 61 66 74 65 ody".string(31)."The.string.afte
05a0 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 20 22 41 72 r.addslashes.is:".string(17)."Ar
05c0 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 22 54 68 65 e.you.\"JOHN\"?".string(33)."The
05e0 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:".
0600 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 0a 73 74 72 string(15)."Are.you."JOHN"?".str
0620 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 64 73 6c 61 ing(31)."The.string.after.addsla
0640 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 70 5c 5c 73 shes.is:".string(21)."c:\\php\\s
0660 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 20 73 74 72 tripslashes".string(33)."The.str
0680 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 73 74 72 69 ing.after.stripslashes.is:".stri
06a0 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 0a 73 74 72 ng(19)."c:\php\stripslashes".str
06c0 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 64 73 6c 61 ing(31)."The.string.after.addsla
06e0 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 70 5c 5c 73 shes.is:".string(21)."c:\\php\\s
0700 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 20 73 74 72 tripslashes".string(33)."The.str
0720 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 73 74 72 69 ing.after.stripslashes.is:".stri
0740 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 0a 73 74 72 ng(19)."c:\php\stripslashes".str
0760 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 64 73 6c 61 ing(31)."The.string.after.addsla
0780 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 30 77 6f 72 shes.is:".string(12)."hello\0wor
07a0 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 66 74 65 72 ld".string(33)."The.string.after
07c0 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 29 20 22 68 .stripslashes.is:".string(11)."h
07e0 65 6c 6c 6f 00 77 6f 72 6c 64 22 0a 44 6f 6e 65 0a ello.world".Done.