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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
<?php /** * Predefined Functions official version known for PHP_CompatInfo 1.9.0a1 or better * * Sources came from : * Revision Link * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/apache/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/apc/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/apd/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/bc/versions.xml * 1.2 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/bzip2/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/com/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/ctype/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/dom/versions.xml * 1.2 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/filter/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/ftp/versions.xml * 1.2 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/gmp/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/hash/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/iconv/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/image/versions.xml * 1.3 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/json/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mbstring/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysql/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/mysqli/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/openssl/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/pcre/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/pdo/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/posix/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/session/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/simplexml/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/spl/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/ssh2/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/tidy/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/wddx/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/xml/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/xmlreader/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/xmlwriter/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/xslt/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/zip/versions.xml * 1.1 http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/zlib/versions.xml * * PHP versions 5 * * @category PHP * @package PHP_CompatInfo * @author Davey Shafik <davey@php.net> * @author Laurent Laville <pear@laurent-laville.org> * @license http://www.opensource.org/licenses/bsd-license.php BSD * @version CVS: $Id: function_exceptions.php,v 1.5 2008/12/29 10:27:42 farell Exp $ * @link http://pear.php.net/package/PHP_CompatInfo */
$function_exceptions = array();
$ds = DIRECTORY_SEPARATOR;
$version_pattern = '\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?'; $ext_pattern = '(.*)\\'.$ds.'phpdocref\\'.$ds.'(.*)\\'.$ds.'versions.xml';
$data_dir = '@data_dir@'.$ds.'@package_name@'.$ds.'data'.$ds.'phpdocref'.$ds;
$aliases = array('bc' => 'bcmath', 'bzip2' => 'bz2', 'datetime' => 'date', 'image' => 'gd', 'pdo' => 'PDO', 'simplexml' => 'SimpleXML', 'spl' => 'SPL' );
// Iterating over extension specific version files foreach(glob($data_dir.'*'.$ds.'versions.xml') as $file) {
preg_match('/'.$ext_pattern.'/', $file, $matches); $ext = $matches[2]; // real extension name, is case sensitive if (isset($aliases[$ext])) { $ext = $aliases[$ext]; }
$xml = simplexml_load_file($file);
foreach ($xml->function as $function) { $name = (string) $function['name']; if (strpos($name, '::') !== false) { // Do not keep extension methods class continue; } $from = (string) $function['from'];
/** * Match strings like : * "PHP 3 >= 3.0.7, PHP 4, PHP 5" for _ * "PHP 5 >= 5.1.0RC1" for date_modify * "PHP 3 >= 3.0.7, PHP 4 <= 4.2.3" for aspell_check * "PHP 5 >= 5.2.0, PECL zip:1.1.0-1.9.0" for addfile */ if (preg_match('/>= ('.$version_pattern.')/', $from, $matches)) { $init = $matches[1]; if (preg_match('/<= ('.$version_pattern.')/', $from, $matches)) { $end = $matches[1]; } else { $end = false; } if (preg_match('/(\.*)PECL ([a-zA-Z_]+):('.$version_pattern.')-('. $version_pattern.')/', $from, $matches)) {
$function_exceptions[$ext][$name]['init'] = $matches[3]; $function_exceptions[$ext][$name]['end'] = $matches[4]; $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = true;
} elseif (preg_match('/(\.*)PECL ([a-zA-Z_]+):('.$version_pattern.')/', $from, $matches)) {
$function_exceptions[$ext][$name]['init'] = $matches[3]; $function_exceptions[$ext][$name]['end'] = $matches[3]; $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = true; } else { $function_exceptions[$ext][$name]['init'] = $init; if ($end !== false) { $function_exceptions[$ext][$name]['end'] = $end; } $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = false; } continue;
/** * Match string like : * "PHP 5 <= 5.0.4" for php_check_syntax * "PHP 4 <= 4.2.3, PECL cybercash:1.18" for cybercash_base64_decode */ } elseif (preg_match('/<= ('.$version_pattern.')/', $from, $matches)) { $end = $matches[1];
if (preg_match('/(\.*)PECL ([a-zA-Z_]+):('.$version_pattern.')-('. $version_pattern.')/', $from, $matches)) {
$function_exceptions[$ext][$name]['init'] = $matches[3]; $function_exceptions[$ext][$name]['end'] = $matches[4]; $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = true; continue;
} elseif (preg_match('/(\.*)PECL ([a-zA-Z_]+):('.$version_pattern.')/', $from, $matches)) {
$function_exceptions[$ext][$name]['init'] = $matches[3]; $function_exceptions[$ext][$name]['end'] = $matches[3]; $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = true; continue; } $function_exceptions[$ext][$name]['end'] = $end; $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = false;
/** * Match string like : * "4.0.2 - 4.0.6 only" for accept_connect */ } elseif (preg_match('/('.$version_pattern.') - ('.$version_pattern.') only/', $from, $matches)) {
$function_exceptions[$ext][$name]['init'] = $matches[1]; $function_exceptions[$ext][$name]['end'] = $matches[2]; $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = false; continue;
/** * Match string like : * "PHP 3.0.5 only" for PHP3_UODBC_FIELD_NUM * "PHP 4.0.6 only" for ocifreecoll */ } elseif (preg_match('/PHP (\d)('.$version_pattern.') only/', $from, $matches)) {
$function_exceptions[$ext][$name]['init'] = $matches[1] .'.0.0'; $function_exceptions[$ext][$name]['end'] = $matches[2]; $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = false; continue;
/** * Match string like : * "PHP 5, PECL oci8:1.1-1.2.4" for oci_error */ } elseif (preg_match('/(\.*)PECL ([a-zA-Z_]+):('.$version_pattern.')-('. $version_pattern.')/', $from, $matches)) {
$function_exceptions[$ext][$name]['init'] = $matches[3]; $function_exceptions[$ext][$name]['end'] = $matches[4]; $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = true; continue;
/** * Match string like : * "PHP 4, PHP 5, PECL mysql:1.0" for mysql_connect */ } elseif (preg_match('/(\.*)PECL ([a-zA-Z_]+):('.$version_pattern.')/', $from, $matches)) {
$function_exceptions[$ext][$name]['init'] = $matches[3]; $function_exceptions[$ext][$name]['end'] = $matches[3]; $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = true; continue; }
if (strpos($function['from'], 'PHP 3') !== false) { $function_exceptions[$ext][$name]['init'] = '3.0.0'; $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = false; continue; } if (strpos($function['from'], 'PHP 4') !== false) { $function_exceptions[$ext][$name]['init'] = '4.0.0'; $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = false; continue; } if (strpos($function['from'], 'PHP 5') !== false) { $function_exceptions[$ext][$name]['init'] = '5.0.0'; $function_exceptions[$ext][$name]['ext'] = $ext; $function_exceptions[$ext][$name]['pecl'] = false; continue; } } } // end-iterating over extension specific version files ?>
|