~ubuntu-branches/ubuntu/raring/php5/raring

« back to all changes in this revision

Viewing changes to ext/standard/tests/strings/stripslashes_variation5.phpt

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-18 16:10:26 UTC
  • mfrom: (1.1.24) (0.3.58 sid)
  • Revision ID: package-import@ubuntu.com-20120618161026-hg1fc5r9z1a4hlqz
Tags: 5.4.4-1ubuntu1
* Merge from Debian unstable. Remaining changes:
  - d/rules: Simplify apache config settings since we never build 
    interbase or firebird.
  - debian/rules: export DEB_HOST_MULTIARCH properly.
  - Add build-dependency on lemon, which we now need.
  - Dropped firebird2.1-dev, libc-client-dev, libmcrypt-dev as it is in universe.
  - Dropped libcurl-dev not in the archive.
  - debian/control: replace build-depends on mysql-server with
    mysql-server-core-5.5 and mysql-client-5.5 to avoid upstart and
    mysql-server-5.5 postinst confusion with starting up multiple
    mysqlds listening on the same port.
  - Dropped php5-imap, php5-interbase, php5-mcrypt since we have versions
    already in universe.
  - Dropped libonig-dev and libqgdbm since its in universe. (libonig MIR
    has been declined due to an inactive upstream. So this is probably
    a permanent change).
  - modulelist: Drop imap, interbase, sybase, and mcrypt.
  - debian/rules:
    * Dropped building of mcrypt, imap, and interbase.
    * Install apport hook for php5.
    * stop mysql instance on clean just in case we failed in tests
* Dropped Changes:
  * d/rules: enable Suhosin patch with PHP5_SUHOSIN=yes -- Upstream suhosin
    has been slow to adopt PHP 5.4, and is showing signs of disengagement.
    Therefore, we will follow Debian's lead and drop Suhosin for now.
  - d/control: build-depend on mysql 5.5 instead of 5.1 for running tests.
    -- Debian just deps on mysql-server
  - Suggest php5-suhosin rather than recommends. -- Dropping suhosin
  - d/setup-mysql.sh: modify to work with mysql 5.5 differences -- superseded
    in Debian.
  - Only build php5-sqlite for sqlite3, dropping the obsolete sqlite2. --
    superseded in Debian
  - d/maxlifetime: Improve maxlifetime script to scan for more SAPIs and 
    scan all *.ini in conf.d directory. -- Change came from Debian
  - d/libapache2-mod-php5.postinst,libapache2-mod-php5filter.postinst: 
    Restart apache on first install to ensure module is fully enabled.
    -- Change came from Debian
  - debian/patches/php5-CVE-2012-1823.patch: filter query strings that
    are prefixed with '-' -- Fixed upstream
  - debian/control: Recommend php5-dev for php-pear. -- This was a poorly
    conceived idea anyway.
  - Pre-Depend on a new enough version of dpkg for dpkg-maintscript-helper
    rather than checking whether it exists at run-time, leading to more
    predictable behaviour on upgrades. -- Applied in Debian
  - d/p/gd-multiarch-fix.patch: superseded
* d/NEWS: add note explaining that SUHOSIN is no longer enabled in the
  Ubuntu packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--TEST--
2
 
Test stripslashes() function : usage variations - with magic_quotes_sybase directive ON
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 PHP directive magic_quotes_sybase set ON 
12
 
*/
13
 
 
14
 
echo "*** Testing stripslashes() : with php directive magic_quotes_sybase set ON ***\n";
15
 
 
16
 
// setting ON the php directive magic_quotes_sybase
17
 
ini_set("magic_quotes_sybase", "1");
18
 
 
19
 
// initialising a heredoc string
20
 
$heredoc_string = <<<EOT
21
 
This is line 1 of 'heredoc' string
22
 
This is line 2 of "heredoc" string
23
 
EOT;
24
 
 
25
 
$heredoc_null_string =<<<EOT
26
 
EOT;
27
 
 
28
 
// initialising the string array
29
 
$str_array = array( 
30
 
                    // string without any characters that can be backslashed
31
 
                    'Hello world',
32
 
 
33
 
                    // string with single quotes
34
 
                    "how're you doing?", 
35
 
                    "don't disturb u'r neighbours",
36
 
                    "don't disturb u'r neighbours''",
37
 
                    '',
38
 
                    '\'',
39
 
                    "'",
40
 
                    
41
 
                    // string with double quotes
42
 
                    'he said, "he will be on leave"',
43
 
                    'he said, ""he will be on leave"',
44
 
                    '"""PHP"""',
45
 
                    "",
46
 
                    "\"",
47
 
                    '"',
48
 
                    "hello\"",
49
 
                         
50
 
                    // string with backslash characters
51
 
                    'Is your name Ram\Krishna?',
52
 
                    'c:\php\testcase\stripslashes',
53
 
                    '\\',
54
 
 
55
 
                    // string with nul characters
56
 
                    'hello'.chr(0).'world',
57
 
                    chr(0).'hello'.chr(0),
58
 
                    chr(0).chr(0).'hello',
59
 
                    chr(0),
60
 
 
61
 
                    // mixed strings
62
 
                    "\\\"'0.0.0.0'",
63
 
                    "\\\"'0.0.0.0'".chr(0),
64
 
                    chr(0)."'c:\php\'",
65
 
                    '"c:\php\"'.chr(0)."'",
66
 
                    '"hello"'."'world'".chr(0).'//',
67
 
 
68
 
                    // string with hexadecimal number
69
 
                    "0xABCDEF0123456789",
70
 
                    "\xabcdef0123456789",
71
 
                    '!@#$%&*@$%#&/;:,<>',
72
 
                    "hello\x00world",
73
 
 
74
 
                    // heredoc strings
75
 
                    $heredoc_string,
76
 
                    $heredoc_null_string
77
 
                  );
78
 
 
79
 
$count = 1;
80
 
// looping to test for all strings in $str_array
81
 
foreach( $str_array as $str )  {
82
 
  echo "\n-- Iteration $count --\n";
83
 
  $str_addslashes = addslashes($str);
84
 
  var_dump("The string after addslashes is:", $str_addslashes);
85
 
  $str_stripslashes = stripslashes($str_addslashes);
86
 
  var_dump("The string after stripslashes is:", $str_stripslashes);
87
 
  if( strcmp($str, $str_stripslashes) != 0 )
88
 
    echo "\nOriginal string and string from stripslashes() donot match\n";
89
 
  $count ++;
90
 
}
91
 
 
92
 
echo "Done\n";
93
 
?>
94
 
--EXPECTF--
95
 
*** Testing stripslashes() : with php directive magic_quotes_sybase set ON ***
96
 
 
97
 
string(31) "The string after addslashes is:"
98
 
string(11) "Hello world"
99
 
string(33) "The string after stripslashes is:"
100
 
string(11) "Hello world"
101
 
 
102
 
string(31) "The string after addslashes is:"
103
 
string(18) "how''re you doing?"
104
 
string(33) "The string after stripslashes is:"
105
 
string(17) "how're you doing?"
106
 
 
107
 
string(31) "The string after addslashes is:"
108
 
string(30) "don''t disturb u''r neighbours"
109
 
string(33) "The string after stripslashes is:"
110
 
string(28) "don't disturb u'r neighbours"
111
 
 
112
 
string(31) "The string after addslashes is:"
113
 
string(34) "don''t disturb u''r neighbours''''"
114
 
string(33) "The string after stripslashes is:"
115
 
string(30) "don't disturb u'r neighbours''"
116
 
 
117
 
string(31) "The string after addslashes is:"
118
 
string(0) ""
119
 
string(33) "The string after stripslashes is:"
120
 
string(0) ""
121
 
 
122
 
string(31) "The string after addslashes is:"
123
 
string(2) "''"
124
 
string(33) "The string after stripslashes is:"
125
 
string(1) "'"
126
 
 
127
 
string(31) "The string after addslashes is:"
128
 
string(2) "''"
129
 
string(33) "The string after stripslashes is:"
130
 
string(1) "'"
131
 
 
132
 
string(31) "The string after addslashes is:"
133
 
string(30) "he said, "he will be on leave""
134
 
string(33) "The string after stripslashes is:"
135
 
string(30) "he said, "he will be on leave""
136
 
 
137
 
string(31) "The string after addslashes is:"
138
 
string(31) "he said, ""he will be on leave""
139
 
string(33) "The string after stripslashes is:"
140
 
string(31) "he said, ""he will be on leave""
141
 
 
142
 
string(31) "The string after addslashes is:"
143
 
string(9) """"PHP""""
144
 
string(33) "The string after stripslashes is:"
145
 
string(9) """"PHP""""
146
 
 
147
 
string(31) "The string after addslashes is:"
148
 
string(0) ""
149
 
string(33) "The string after stripslashes is:"
150
 
string(0) ""
151
 
 
152
 
string(31) "The string after addslashes is:"
153
 
string(1) """
154
 
string(33) "The string after stripslashes is:"
155
 
string(1) """
156
 
 
157
 
string(31) "The string after addslashes is:"
158
 
string(1) """
159
 
string(33) "The string after stripslashes is:"
160
 
string(1) """
161
 
 
162
 
string(31) "The string after addslashes is:"
163
 
string(6) "hello""
164
 
string(33) "The string after stripslashes is:"
165
 
string(6) "hello""
166
 
 
167
 
string(31) "The string after addslashes is:"
168
 
string(25) "Is your name Ram\Krishna?"
169
 
string(33) "The string after stripslashes is:"
170
 
string(25) "Is your name Ram\Krishna?"
171
 
 
172
 
string(31) "The string after addslashes is:"
173
 
string(28) "c:\php\testcase\stripslashes"
174
 
string(33) "The string after stripslashes is:"
175
 
string(28) "c:\php\testcase\stripslashes"
176
 
 
177
 
string(31) "The string after addslashes is:"
178
 
string(1) "\"
179
 
string(33) "The string after stripslashes is:"
180
 
string(1) "\"
181
 
 
182
 
string(31) "The string after addslashes is:"
183
 
string(12) "hello\0world"
184
 
string(33) "The string after stripslashes is:"
185
 
string(11) "helloworld"
186
 
 
187
 
string(31) "The string after addslashes is:"
188
 
string(9) "\0hello\0"
189
 
string(33) "The string after stripslashes is:"
190
 
string(7) "hello"
191
 
 
192
 
string(31) "The string after addslashes is:"
193
 
string(9) "\0\0hello"
194
 
string(33) "The string after stripslashes is:"
195
 
string(7) "hello"
196
 
 
197
 
string(31) "The string after addslashes is:"
198
 
string(2) "\0"
199
 
string(33) "The string after stripslashes is:"
200
 
string(1) ""
201
 
 
202
 
string(31) "The string after addslashes is:"
203
 
string(13) "\"''0.0.0.0''"
204
 
string(33) "The string after stripslashes is:"
205
 
string(11) "\"'0.0.0.0'"
206
 
 
207
 
string(31) "The string after addslashes is:"
208
 
string(15) "\"''0.0.0.0''\0"
209
 
string(33) "The string after stripslashes is:"
210
 
string(12) "\"'0.0.0.0'"
211
 
 
212
 
string(31) "The string after addslashes is:"
213
 
string(13) "\0''c:\php\''"
214
 
string(33) "The string after stripslashes is:"
215
 
string(10) "'c:\php\'"
216
 
 
217
 
string(31) "The string after addslashes is:"
218
 
string(13) ""c:\php\"\0''"
219
 
string(33) "The string after stripslashes is:"
220
 
string(11) ""c:\php\"'"
221
 
 
222
 
string(31) "The string after addslashes is:"
223
 
string(20) ""hello"''world''\0//"
224
 
string(33) "The string after stripslashes is:"
225
 
string(17) ""hello"'world'//"
226
 
 
227
 
string(31) "The string after addslashes is:"
228
 
string(18) "0xABCDEF0123456789"
229
 
string(33) "The string after stripslashes is:"
230
 
string(18) "0xABCDEF0123456789"
231
 
 
232
 
string(31) "The string after addslashes is:"
233
 
string(15) "�cdef0123456789"
234
 
string(33) "The string after stripslashes is:"
235
 
string(15) "�cdef0123456789"
236
 
 
237
 
string(31) "The string after addslashes is:"
238
 
string(18) "!@#$%&*@$%#&/;:,<>"
239
 
string(33) "The string after stripslashes is:"
240
 
string(18) "!@#$%&*@$%#&/;:,<>"
241
 
 
242
 
string(31) "The string after addslashes is:"
243
 
string(12) "hello\0world"
244
 
string(33) "The string after stripslashes is:"
245
 
string(11) "helloworld"
246
 
 
247
 
string(31) "The string after addslashes is:"
248
 
string(71) "This is line 1 of ''heredoc'' string
249
 
This is line 2 of "heredoc" string"
250
 
string(33) "The string after stripslashes is:"
251
 
string(69) "This is line 1 of 'heredoc' string
252
 
This is line 2 of "heredoc" string"
253
 
 
254
 
string(31) "The string after addslashes is:"
255
 
string(0) ""
256
 
string(33) "The string after stripslashes is:"
257
 
string(0) ""
258
 
Done