1--TEST--
2Test var_export() function with valid strings
3--FILE--
4<?php
5echo "*** Testing var_export() with valid strings ***\n";
6// different valid  string
7$valid_strings = array(
8            "\"\"" => "",
9            "\" \"" => " ",
10            "''" => '',
11            "' '" => ' ',
12            "\"string\"" => "string",
13            "'string'" => 'string',
14            "\"\\0Hello\\0 World\\0\"" => "\0Hello\0 World\0",
15            "\"NULL\"" => "NULL",
16            "'null'" => 'null',
17            "\"FALSE\"" => "FALSE",
18            "'false'" => 'false',
19            "\"\\x0b\"" => "\x0b",
20            "\"\\0\"" => "\0",
21            "'\\0'" => '\0',
22            "'\\060'" => '\060',
23            "\"\\070\"" => "\070"
24);
25
26/* Loop to check for above strings with var_export() */
27echo "\n*** Output for strings ***\n";
28foreach($valid_strings as $key => $str) {
29    echo "\n-- Iteration: $key --\n";
30    var_export( $str );
31    echo "\n";
32    var_export( $str, FALSE);
33    echo "\n";
34    var_dump( var_export( $str, TRUE) );
35    echo "\n";
36}
37
38?>
39--EXPECT--
40*** Testing var_export() with valid strings ***
41
42*** Output for strings ***
43
44-- Iteration: "" --
45''
46''
47string(2) "''"
48
49
50-- Iteration: " " --
51' '
52' '
53string(3) "' '"
54
55
56-- Iteration: '' --
57''
58''
59string(2) "''"
60
61
62-- Iteration: ' ' --
63' '
64' '
65string(3) "' '"
66
67
68-- Iteration: "string" --
69'string'
70'string'
71string(8) "'string'"
72
73
74-- Iteration: 'string' --
75'string'
76'string'
77string(8) "'string'"
78
79
80-- Iteration: "\0Hello\0 World\0" --
81'' . "\0" . 'Hello' . "\0" . ' World' . "\0" . ''
82'' . "\0" . 'Hello' . "\0" . ' World' . "\0" . ''
83string(49) "'' . "\0" . 'Hello' . "\0" . ' World' . "\0" . ''"
84
85
86-- Iteration: "NULL" --
87'NULL'
88'NULL'
89string(6) "'NULL'"
90
91
92-- Iteration: 'null' --
93'null'
94'null'
95string(6) "'null'"
96
97
98-- Iteration: "FALSE" --
99'FALSE'
100'FALSE'
101string(7) "'FALSE'"
102
103
104-- Iteration: 'false' --
105'false'
106'false'
107string(7) "'false'"
108
109
110-- Iteration: "\x0b" --
111''
112''
113string(3) "''"
114
115
116-- Iteration: "\0" --
117'' . "\0" . ''
118'' . "\0" . ''
119string(14) "'' . "\0" . ''"
120
121
122-- Iteration: '\0' --
123'\\0'
124'\\0'
125string(5) "'\\0'"
126
127
128-- Iteration: '\060' --
129'\\060'
130'\\060'
131string(7) "'\\060'"
132
133
134-- Iteration: "\070" --
135'8'
136'8'
137string(3) "'8'"
138
139