blob: f086b99b76b39d79c5fe11692801e53eb556e5d4 (
plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
--TEST--
get_meta_tags() tests
--FILE--
<?php
$filename = dirname(__FILE__)."/get_meta_tags.html";
$data = <<<DATA
<meta name="author" content="name">
<meta name="keywords" content="php documentation">
<meta name="DESCRIPTION" content="a php manual">
<meta name="geo.position" content="49.33;-86.59">
</head> <!-- parsing stops here -->
DATA;
$data1 = <<<DATA
<html>
<head>
<meta name="author" content="name">
<meta name="keywords" content="php documentation">
<meta name="DESCRIPTION" content="a php manual">
<meta name="geo.position" content="49.33;-86.59">
</head>
<body>
<meta name="author" content="name1">
<meta name="keywords" content="php documentation1">
<meta name="DESCRIPTION" content="a php manual1">
<meta name="geo.position" content="49.33;-86.591">
</body>
</html>
DATA;
$data2 = <<<DATA
<meta name="author" content="name"
<meta name="keywords" content="php documentation">
DATA;
$data3 = <<<DATA
<meta <meta name="keywords" content="php documentation">
DATA;
$data4 = <<<DATA
<meta name="author" content="name"
<meta name="keywords" content="php documentation"
DATA;
$array = array($data, $data1, $data2, $data3, $data4, "", "<>", "<meta<<<<<");
foreach ($array as $html) {
file_put_contents($filename, $html);
var_dump(get_meta_tags($filename));
}
@unlink($filename);
echo "Done\n";
?>
--EXPECTF--
array(4) {
["author"]=>
string(4) "name"
["keywords"]=>
string(17) "php documentation"
["description"]=>
string(12) "a php manual"
["geo_position"]=>
string(12) "49.33;-86.59"
}
array(4) {
["author"]=>
string(4) "name"
["keywords"]=>
string(17) "php documentation"
["description"]=>
string(12) "a php manual"
["geo_position"]=>
string(12) "49.33;-86.59"
}
array(1) {
["keywords"]=>
string(17) "php documentation"
}
array(1) {
["keywords"]=>
string(17) "php documentation"
}
array(0) {
}
array(0) {
}
array(0) {
}
array(0) {
}
Done
|