@@ -208,7 +208,7 @@ function getCurlConstants() : array
208
208
$ html = file_get_contents (CURL_DOC_FILE );
209
209
210
210
// Extract the constant list from the HTML file (located in the only <pre> tag in the page)
211
- preg_match ('~<pre>([^<]+ )</pre>~ ' , $ html , $ matches );
211
+ preg_match ('~<table>(.*? )</table>~s ' , $ html , $ matches );
212
212
$ constantList = $ matches [1 ];
213
213
214
214
/**
@@ -220,16 +220,16 @@ function getCurlConstants() : array
220
220
* CURLOPT_FTPASCII 7.1 7.11.1 7.15.5
221
221
* CURLOPT_HTTPREQUEST 7.1 - 7.15.5
222
222
*/
223
- $ regexp = '/^( [A-Za-z0-9_]+) +([0-9\ .]+)(?: +([0-9\.\- ]+)) ?(?: +([0-9\ .]+))?/ m ' ;
223
+ $ regexp = '@<tr><td>(?:<a href=".*?">)?(?<const> [A-Za-z0-9_]+)(?:</a>)?</td><td>(?:<a href=".*?">)?(?<added>[\d\ .]+)(?:</a>)?</td><td>(?:<a href=".*?">)?(?<deprecated>[\d\. ]+)?(?:</a>)?</td><td>(<a href=".*?">)?(?<removed>[\d\ .]+)?(</a>)?</td></tr>@ m ' ;
224
224
preg_match_all ($ regexp , $ constantList , $ matches , PREG_SET_ORDER );
225
225
226
226
$ constants = [];
227
227
228
228
foreach ($ matches as $ match ) {
229
- $ name = $ match [1 ];
230
- $ introduced = $ match [2 ];
231
- $ deprecated = $ match [3 ] ?? null ;
232
- $ removed = $ match [4 ] ?? null ;
229
+ $ name = $ match [' const ' ];
230
+ $ introduced = $ match [' added ' ];
231
+ $ deprecated = $ match [' deprecated ' ] ?? null ;
232
+ $ removed = $ match [' removed ' ] ?? null ;
233
233
234
234
if (in_array ($ name , IGNORED_CURL_CONSTANTS , true ) || !preg_match (CONSTANTS_REGEX_PATTERN , $ name )) {
235
235
// not a wanted constant
0 commit comments