Skip to content

Commit 24c24fc

Browse files
committed
Fix some implementation bugs
1 parent 629071d commit 24c24fc

16 files changed

+654
-504
lines changed

Zend/tests/flexible-heredoc-error1.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ Flexible heredoc syntax 1: different indentation for body (spaces) ending marker
33
--FILE--
44
<?php
55

6-
try {
7-
echo <<<END
6+
echo <<<END
87
a
98
b
109
c
1110
END;
12-
} catch (ParseError $pe) {
13-
var_dump($e->getMessage());
14-
}
1511
--EXPECTF--
1612
Parse error: Invalid indentation - tabs and spaces cannot be mixed in %s on line %d

Zend/tests/flexible-heredoc-error2.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ Flexible heredoc syntax 2: mixing spaces and tabs in body
33
--FILE--
44
<?php
55

6-
try {
7-
echo <<<END
6+
echo <<<END
87
a
98
b
109
c
1110
END;
12-
} catch (ParseError $pe) {
13-
var_dump($e->getMessage());
14-
}
1511
--EXPECTF--
1612
Parse error: Invalid indentation - tabs and spaces cannot be mixed in %s on line %d

Zend/tests/flexible-heredoc-error3.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ Flexible heredoc syntax error 3: mixing spaces and tabs in ending marker
33
--FILE--
44
<?php
55

6-
try {
7-
echo <<<END
6+
echo <<<END
87
a
98
b
109
c
1110
END;
12-
} catch (ParseError $pe) {
13-
var_dump($e->getMessage());
14-
}
1511
--EXPECTF--
1612
Parse error: Invalid indentation - tabs and spaces cannot be mixed in %s on line %d

Zend/tests/flexible-heredoc-error4.phpt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ Flexible heredoc syntax error 4: not enough body indentation
33
--FILE--
44
<?php
55

6-
try {
7-
echo <<<END
6+
echo <<<END
87
a
98
b
109
c
1110
END;
12-
} catch (ParseError $pe) {
13-
var_dump($e->getMessage());
14-
}
1511
--EXPECTF--
16-
Parse error: Invalid body indentation level (expecting an indentation at least 5) in %s on line %d
12+
Parse error: Invalid body indentation level (expecting an indentation level of at least 5) in %s on line %d
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--TEST--
2+
Flexible heredoc syntax error 5: mixing spaces and tabs in ending marker for 0 length body
3+
--FILE--
4+
<?php
5+
6+
echo <<<END
7+
END;
8+
--EXPECTF--
9+
Parse error: Invalid indentation - tabs and spaces cannot be mixed in %s on line %d
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--TEST--
2+
Flexible heredoc syntax error 6: no ending token on 0 length body
3+
--FILE--
4+
<?php
5+
6+
echo <<<END
7+
--EXPECTF--
8+
Parse error: syntax error, unexpected end of file in %s on line %d
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--TEST--
2+
Flexible heredoc syntax error 7: no ending token
3+
--FILE--
4+
<?php
5+
6+
echo <<<END
7+
8+
--EXPECTF--
9+
Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in %s on line %d

Zend/tests/flexible-heredoc-nowdoc.phpt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,29 @@ Flexible heredoc/nowdoc syntax
33
--FILE--
44
<?php
55

6+
$test = 'c';
7+
8+
var_dump(<<<'END'
9+
END);
10+
11+
var_dump(<<<END
12+
13+
END);
14+
615
echo <<<'END'
716
a
817
b
18+
919
c
20+
1021
d
1122
e
1223
END, PHP_EOL;
1324

1425
echo <<<END
1526
a
1627
b
17-
c
28+
$test
1829
d
1930
e
2031
END, PHP_EOL;
@@ -37,7 +48,7 @@ echo <<<END
3748
a\r\n
3849
\ta\n
3950
b\r\n
40-
c\n
51+
$test\n
4152
d\r\n
4253
e\n
4354
END, PHP_EOL;
@@ -51,9 +62,13 @@ e
5162
END, PHP_EOL;
5263
?>
5364
--EXPECT--
65+
string(0) ""
66+
string(0) ""
5467
a
5568
b
69+
5670
c
71+
5772
d
5873
e
5974
a

Zend/tests/flexible-nowdoc-error1.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ Flexible nowdoc syntax 1: different indentation for body (spaces) ending marker
33
--FILE--
44
<?php
55

6-
try {
7-
echo <<<'END'
6+
echo <<<'END'
87
a
98
b
109
c
1110
END;
12-
} catch (ParseError $pe) {
13-
var_dump($e->getMessage());
14-
}
1511
--EXPECTF--
1612
Parse error: Invalid indentation - tabs and spaces cannot be mixed in %s on line %d

Zend/tests/flexible-nowdoc-error2.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ Flexible nowdoc syntax 2: mixing spaces and tabs in body
33
--FILE--
44
<?php
55

6-
try {
7-
echo <<<'END'
6+
echo <<<'END'
87
a
98
b
109
c
1110
END;
12-
} catch (ParseError $pe) {
13-
var_dump($e->getMessage());
14-
}
1511
--EXPECTF--
1612
Parse error: Invalid indentation - tabs and spaces cannot be mixed in %s on line %d

0 commit comments

Comments
 (0)