Annotation of embedaddon/php/ext/standard/tests/strings/stripslashes_variation3.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test stripslashes() function : usage variations - strings with newline and tab characters
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : string stripslashes ( string $str )
! 6: * Description: Returns an un-quoted string
! 7: * Source code: ext/standard/string.c
! 8: */
! 9:
! 10: /*
! 11: * Test stripslashes() with strings containing newline and tab characters.
! 12: */
! 13:
! 14: echo "*** Testing stripslashes() : with strings containing newline and tab characters ***\n";
! 15:
! 16: // initialising heredoc strings
! 17: $heredoc_string_with_newline = <<<EOT
! 18: This is line 1 \nof 'heredoc' string
! 19: This is line 2 \nof "heredoc" string
! 20: EOT;
! 21:
! 22: $heredoc_string_with_tab = <<<EOT
! 23: This is line 1 \tof 'heredoc' string
! 24: This is line 2 \tof "heredoc" string
! 25: EOT;
! 26: // initialising the string array
! 27:
! 28: $str_array = array(
! 29: // string with newline character
! 30: "\n",
! 31: "\\n",
! 32: "Hello \nworld",
! 33: "Hello \\nworld",
! 34: '\n',
! 35: '\\n',
! 36: 'Hello \nworld',
! 37: 'Hello \\nworld',
! 38: $heredoc_string_with_newline,
! 39:
! 40: // string with tab character
! 41: "\t",
! 42: "\\t",
! 43: "Hello \tworld",
! 44: "Hello \\tworld",
! 45: '\t',
! 46: '\\t',
! 47: 'Hello \tworld',
! 48: 'Hello \\tworld',
! 49: $heredoc_string_with_tab
! 50: );
! 51:
! 52: $count = 1;
! 53: // looping to test for all strings in $str_array
! 54: foreach( $str_array as $str ) {
! 55: echo "\n-- Iteration $count --\n";
! 56: var_dump( stripslashes($str) );
! 57: $count ++;
! 58: }
! 59:
! 60: echo "Done\n";
! 61: ?>
! 62: --EXPECTF--
! 63: *** Testing stripslashes() : with strings containing newline and tab characters ***
! 64:
! 65: -- Iteration 1 --
! 66: string(1) "
! 67: "
! 68:
! 69: -- Iteration 2 --
! 70: string(1) "n"
! 71:
! 72: -- Iteration 3 --
! 73: string(12) "Hello
! 74: world"
! 75:
! 76: -- Iteration 4 --
! 77: string(12) "Hello nworld"
! 78:
! 79: -- Iteration 5 --
! 80: string(1) "n"
! 81:
! 82: -- Iteration 6 --
! 83: string(1) "n"
! 84:
! 85: -- Iteration 7 --
! 86: string(12) "Hello nworld"
! 87:
! 88: -- Iteration 8 --
! 89: string(12) "Hello nworld"
! 90:
! 91: -- Iteration 9 --
! 92: string(71) "This is line 1
! 93: of 'heredoc' string
! 94: This is line 2
! 95: of "heredoc" string"
! 96:
! 97: -- Iteration 10 --
! 98: string(1) " "
! 99:
! 100: -- Iteration 11 --
! 101: string(1) "t"
! 102:
! 103: -- Iteration 12 --
! 104: string(12) "Hello world"
! 105:
! 106: -- Iteration 13 --
! 107: string(12) "Hello tworld"
! 108:
! 109: -- Iteration 14 --
! 110: string(1) "t"
! 111:
! 112: -- Iteration 15 --
! 113: string(1) "t"
! 114:
! 115: -- Iteration 16 --
! 116: string(12) "Hello tworld"
! 117:
! 118: -- Iteration 17 --
! 119: string(12) "Hello tworld"
! 120:
! 121: -- Iteration 18 --
! 122: string(71) "This is line 1 of 'heredoc' string
! 123: This is line 2 of "heredoc" string"
! 124: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>