Skip to content

Commit fe8dc19

Browse files
committed
yaml_parse_file_002.phpt: Fix expectations for PHP 8.0.0beta1
Update test and expectations to pass under PHP 8.0.0beta1 after php/php-src@c3105a1 changed `php_stream_open_wrapper` to raise a ValueError instead of emitting a warning for an empty filename.
1 parent be25a07 commit fe8dc19

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<license uri="http://www.opensource.org/licenses/mit-license.php">MIT</license>
3333
<notes>
3434
Bugs Fixed:
35+
- yaml_parse_file_002.phpt: Fix expectations for PHP 8.0.0beta1 (bd808)
3536
- Remove use of call_user_function_ex() for compat with PHP 8.0.0a2 (andypost)
3637
- Adjust test values for compat with 32bit platforms (bd808)
3738
- Fix memory leaks (cmb69)

tests/yaml_parse_file_002.phpt

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,32 @@ yaml.decode_timestamp=1
77
date.timezone=GMT
88
--FILE--
99
<?php
10-
yaml_parse_file(NULL);
11-
yaml_parse_file('');
10+
try {
11+
// PHP7 emits a Warning here
12+
yaml_parse_file(NULL);
13+
} catch (ValueError $e) {
14+
// PHP8 raises this exception
15+
echo "\nWarning: yaml_parse_file(): {$e->getMessage()} in " . __FILE__ . " on line 4\n";
16+
}
17+
try {
18+
// PHP7 emits a Warning here
19+
yaml_parse_file('');
20+
} catch (ValueError $e) {
21+
// PHP8 raises this exception
22+
echo "\nWarning: yaml_parse_file(): {$e->getMessage()} in " . __FILE__ . " on line 11\n";
23+
}
1224
yaml_parse_file('invalid');
1325
try {
1426
// PHP7 emits a Warning here
1527
yaml_parse_file();
1628
} catch (ArgumentCountError $e) {
1729
// PHP8 raises this exception
18-
echo "\nWarning: {$e->getMessage()} in " . __FILE__ . " on line 7\n";
30+
echo "\nWarning: {$e->getMessage()} in " . __FILE__ . " on line 19\n";
1931
}
2032
--EXPECTF--
21-
Warning: yaml_parse_file(): Filename cannot be empty in %s on line %d
33+
Warning: yaml_parse_file(): %r(Filename|Path)%r cannot be empty in %s on line %d
2234

23-
Warning: yaml_parse_file(): Filename cannot be empty in %s on line %d
35+
Warning: yaml_parse_file(): %r(Filename|Path)%r cannot be empty in %s on line %d
2436

2537
Warning: yaml_parse_file(invalid): %r[Ff]%railed to open stream: No such file or directory in %s on line %d
2638

0 commit comments

Comments
 (0)