forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path010.phpt
54 lines (42 loc) · 1.05 KB
/
010.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--TEST--
xmlwriter_start/end_attribute()
--EXTENSIONS--
xmlwriter
--FILE--
<?php
$file = __DIR__.'/010.tmp';
$xw = xmlwriter_open_uri($file);
var_dump(xmlwriter_start_element($xw, "tag"));
var_dump(xmlwriter_start_attribute($xw, "attr"));
var_dump(xmlwriter_end_attribute($xw));
try {
xmlwriter_start_attribute($xw, "-1");
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}
var_dump(xmlwriter_end_attribute($xw));
try {
xmlwriter_start_attribute($xw, "\"");
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}
var_dump(xmlwriter_end_attribute($xw));
var_dump(xmlwriter_end_element($xw));
// Force to write and empty the buffer
xmlwriter_flush($xw, empty: true);
unset($xw);
var_dump(file_get_contents($file));
@unlink($file);
echo "Done\n";
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
xmlwriter_start_attribute(): Argument #2 ($name) must be a valid attribute name, "-1" given
bool(false)
xmlwriter_start_attribute(): Argument #2 ($name) must be a valid attribute name, """ given
bool(false)
bool(true)
string(14) "<tag attr=""/>"
Done